UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

39 lines (25 loc) 1.78 kB
--- lang: en title: 'API docs: authentication.authenticationstrategy' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/authentication permalink: /doc/en/lb4/apidocs.authentication.authenticationstrategy.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/authentication](./authentication.md) &gt; [AuthenticationStrategy](./authentication.authenticationstrategy.md) ## AuthenticationStrategy interface An interface that describes the common authentication strategy. An authentication strategy is a class with an 'authenticate' method that verifies a user's credentials and returns the corresponding user profile. <b>Signature:</b> ```typescript export interface AuthenticationStrategy ``` ## Properties | Property | Type | Description | | --- | --- | --- | | [name](./authentication.authenticationstrategy.name.md) | string | The 'name' property is a unique identifier for the authentication strategy ( for example : 'basic', 'jwt', etc) | ## Methods | Method | Description | | --- | --- | | [authenticate(request)](./authentication.authenticationstrategy.authenticate.md) | The 'authenticate' method takes in a given request and returns a user profile which is an instance of 'UserProfile'. (A user profile is a minimal subset of a user object) If the user credentials are valid, this method should return a 'UserProfile' instance. If the user credentials are invalid, this method should throw an error If the user credentials are missing, this method should throw an error, or return 'undefined' and let the authentication action deal with it. |