Skip to content

web-backend


Class: LocalStrategy

Defined in: packages/web-backend/src/auth/strategies/local.strategy.ts:13

  1. The Local Strategy (AuthGuard('local')) gets the User credentials (username and password) from the request body. The credentials are then sent to the validate() method.
  2. The validate() method checks whether the user is in the database using the AuthService.loginUser() method.

Extends

  • Strategy<this> & PassportStrategyMixin<unknown, this>

Constructors

Constructor

new LocalStrategy(authService): LocalStrategy

Defined in: packages/web-backend/src/auth/strategies/local.strategy.ts:19

Instantiate the Local strategy.

Parameters

authService

AuthService

Service used to validate user credentials.

Returns

LocalStrategy

Overrides

PassportStrategy(Strategy, "local").constructor

Methods

validate()

validate(username, password): Promise<User | UnauthorizedException>

Defined in: packages/web-backend/src/auth/strategies/local.strategy.ts:29

Validate credentials coming from the local strategy.

Parameters

username

string

Username provided via request body.

password

string

Password provided via request body.

Returns

Promise<User | UnauthorizedException>

Authenticated User or throws UnauthorizedException.

Overrides

PassportStrategy(Strategy, "local").validate