fix auth header formatting issue

This commit is contained in:
Jake Potrebic 2020-08-10 14:49:35 -07:00
parent b833bc0f0d
commit 8b07f24e48
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
3 changed files with 3 additions and 6 deletions

View File

@ -17,7 +17,7 @@ export class API {
contentType: isFormData ? false : 'application/json',
data: isBodyRequest && !isFormData ? JSON.stringify(data) : data,
processData: !(isFormData || isBodyRequest),
headers: {'Authorization': 'HangarApi session=' + session}
headers: {'Authorization': 'HangarApi session="' + session + '"'}
}).done((data) => {
resolve(data);
}).fail((xhr) => {

View File

@ -48,13 +48,12 @@ public class AuthenticationService {
private final AuthenticationManager authenticationManager;
private final RoleService roleService;
private final PermissionService permissionService;
private final SsoService ssoService;
private static final String UUID_REGEX = "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}";
private static final String UUID_REGEX = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
private static final Pattern API_KEY_PATTERN = Pattern.compile("(" + UUID_REGEX + ").(" + UUID_REGEX + ")");
@Autowired
public AuthenticationService(HttpServletRequest request, ApiAuthInfo apiAuthInfo, HangarConfig hangarConfig, HangarDao<UserDao> userDao, HangarDao<SessionsDao> sessionsDao, HangarDao<ApiKeyDao> apiKeyDao, AuthenticationManager authenticationManager, RoleService roleService, PermissionService permissionService, SsoService ssoService) {
public AuthenticationService(HttpServletRequest request, ApiAuthInfo apiAuthInfo, HangarConfig hangarConfig, HangarDao<UserDao> userDao, HangarDao<SessionsDao> sessionsDao, HangarDao<ApiKeyDao> apiKeyDao, AuthenticationManager authenticationManager, RoleService roleService, PermissionService permissionService) {
this.request = request;
this.apiAuthInfo = apiAuthInfo;
this.hangarConfig = hangarConfig;
@ -64,7 +63,6 @@ public class AuthenticationService {
this.authenticationManager = authenticationManager;
this.roleService = roleService;
this.permissionService = permissionService;
this.ssoService = ssoService;
}
public ApiAuthInfo getApiAuthInfo(String token) {

View File

@ -1,6 +1,5 @@
package me.minidigger.hangar.util;
import org.checkerframework.checker.units.qual.A;
import org.jetbrains.annotations.Nullable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;