mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-08 20:59:08 +00:00
FIX: add authentication to swagger
This commit is contained in:
@@ -54,14 +54,11 @@ export class AuthenticationGuard
|
||||
>(AUTH_FUNCTION_KEY, [ctx.getClass(), ctx.getHandler()]);
|
||||
const mustBeAuthenticated = authFunctions.length > 0;
|
||||
|
||||
if (!mustBeAuthenticated) return true;
|
||||
|
||||
const request = ctx.switchToHttp().getRequest();
|
||||
const accessToken = this.validateToken(request, mustBeAuthenticated);
|
||||
|
||||
if (!mustBeAuthenticated) {
|
||||
// no need to be authenticated
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!accessToken) {
|
||||
// couldn't load valid token
|
||||
throw new ErrorBuilder(ErrorCodes.AUTH.UNAUTHORIZED);
|
||||
|
||||
Reference in New Issue
Block a user