GitLab wurde aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Vielen Dank für Ihre Geduld.

Commit b6fafbef authored by Christopher Fullarton's avatar Christopher Fullarton
Browse files

Fixes admin authentication

parent 94508d62
......@@ -27,8 +27,9 @@ export async function roleAuthorizationChecker(action: Action, searchRoles: User
username = decBasicAuth[0];
password = decBasicAuth[1];
} else {
const decodedToken = AuthService.decodeToken(action.request.headers.authorization);
} else if (action.request.headers.authorization.startsWith('Bearer ')) {
const token = action.request.headers.authorization.replace('Bearer ', '');
const decodedToken = AuthService.decodeToken(token);
if (typeof decodedToken !== 'object' || !(decodedToken as any).name) {
return false;
......@@ -36,6 +37,8 @@ export async function roleAuthorizationChecker(action: Action, searchRoles: User
return (searchRoles as unknown as Array<string>).some(role => (decodedToken as any).userAuthorizations.includes(UserRole[role]));
}
return false;
}
const authenticated = await AuthService.authenticate({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment