Skip to main content

Interface: AuthStrategy

Defined in: service-core/src/auth/AuthStrategy.ts:34

Describes an interface for implementing strategies that will perform authentication.

Properties​

name​

readonly name: string

Defined in: service-core/src/auth/AuthStrategy.ts:36

The unique name of the strategy used to register with the AuthMiddleware.

Methods​

authenticate()​

authenticate(req, res?): Promise<AuthResult | undefined>

Defined in: service-core/src/auth/AuthStrategy.ts:46

Attempts to perform authentication with the given request data. If authentication was successful, returns an AuthResult containing the authentication details. If authentication fails and required is set to true throws an error, otherwise returns undefined.

Parameters​

req​

HttpRequest

The request containing data to attempt authentication with.

res?​

HttpResponse

The response to use when writing back directly to the client.

Returns​

Promise<AuthResult | undefined>


authenticateSync()​

authenticateSync(req, res?): AuthResult | undefined

Defined in: service-core/src/auth/AuthStrategy.ts:58

Attempts to perform authentication with the given request data. If authentication was successful, returns an AuthResult containing the authentication details. If authentication fails and required is set to true throws an error, otherwise returns undefined.

This is the synchronous version of authenticate that performs blocking based authentication.

Parameters​

req​

HttpRequest

The request containing data to attempt authentication with.

res?​

HttpResponse

The response to use when writing back directly to the client.

Returns​

AuthResult | undefined