Skip to main content

Class: BasicStrategy

Defined in: auth/src/auth/BasicStrategy.ts:70

Implements an authentication strategy that performs basic id and password authentication. This strategy requires an existing user account to have already registered a valid password that will be validated. The strategy does not implement how that password is to be validated or stored.

Implements​

  • AuthStrategy

Constructors​

Constructor​

new BasicStrategy(options?): BasicStrategy

Defined in: auth/src/auth/BasicStrategy.ts:74

Parameters​

options?​

BasicStrategyOptions = ...

Returns​

BasicStrategy

Properties​

name​

readonly name: string = "basic"

Defined in: auth/src/auth/BasicStrategy.ts:71

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

Implementation of​

AuthStrategy.name

Methods​

authenticate()​

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

Defined in: auth/src/auth/BasicStrategy.ts:78

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.

required?​

boolean

Returns​

Promise<AuthResult | undefined>

Implementation of​

AuthStrategy.authenticate


authenticateSync()​

authenticateSync(req, res, required?): AuthResult | undefined

Defined in: auth/src/auth/BasicStrategy.ts:108

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.

required?​

boolean

Returns​

AuthResult | undefined

Implementation of​

AuthStrategy.authenticateSync