Skip to main content

Class: CheckAuthAccessTokenGuard

api-internal/check-auth-access-token.guard.CheckAuthAccessTokenGuard

Guard for checking the presence of an access token in the request. If needed, checks for admin permissions of the user.

Used with @UseGuards(CheckAuthAccessTokenGuard)

The access token is expected in the "Authorization" header, prefixed with "Bearer ". Not providing a token, a token without prefix or an invalid token will result in a 401 Unauthorized response.

Once access token (and admin permission) were verified sucessfully, the logged in user is written to the request state object

Hierarchy

Constructors

constructor

new CheckAuthAccessTokenGuard(tokenService, reflector, backendUserService)

Parameters

NameType
tokenServiceTokenService
reflectorReflector
backendUserServiceBackendUserService

Overrides

CheckAccessTokenGuard.constructor

Defined in

gropius-login-service/backend/src/api-internal/check-auth-access-token.guard.ts:21

Methods

canActivate

canActivate(context): Promise<boolean>

Parameters

NameType
contextExecutionContext

Returns

Promise<boolean>

Inherited from

CheckAccessTokenGuard.canActivate

Defined in

gropius-login-service/backend/src/util/CheckAccessTokenGuard.ts:30