### Class: authenticationcomponent = new AuthenticationComponent()

Properties

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
providers | `ProviderMap` |  | exported optional |

#### constructor() : AuthenticationComponent

### Interface: AuthenticationMetadata

Authentication metadata stored via Reflection API

Properties

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
options | `Object` |  | exported optional | Authentication metadata stored via Reflection API
strategy | `string` |  | exported | Authentication metadata stored via Reflection API

### Function: authenticate

#### authenticate(strategyName: string, options: undefined | object) : anonymous

Mark a controller method as requiring authenticated user.

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
strategyName | `string` |  |  | The name of the authentication strategy to use.
options | `undefined | object` |  | optional | Additional options to configure the authentication.

### Function: getAuthenticateMetadata

#### getAuthenticateMetadata(controllerClass: Constructor<__type>, methodName: string) : AuthenticationMetadata | undefined

Fetch authentication metadata stored by `@authenticate` decorator.

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
controllerClass | `Constructor<__type>` |  |  | Target controller
methodName | `string` |  |  | Target method

### Namespace: AuthenticationBindings

Binding keys used by this component.

### const AuthenticationBindings.AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME = "authentication.strategies"

Binding keys used by this component.

### const AuthenticationBindings.AUTH_ACTION = BindingKey.create<AuthenticateFn>( 'authentication.actions.authenticate', )

Key used to inject the authentication function into the sequence.

### const AuthenticationBindings.CURRENT_USER = BindingKey.create<UserProfile | undefined>( 'authentication.currentUser', )

Key used to inject the user instance retrieved by the authentication function

### const AuthenticationBindings.METADATA = BindingKey.create<AuthenticationMetadata | undefined>( 'authentication.operationMetadata', )

Key used to inject authentication metadata, which is used to determine whether a request requires authentication or not.

### const AuthenticationBindings.STRATEGY = BindingKey.create<AuthenticationStrategy | undefined>( 'authentication.strategy', )

Key used to bind an authentication strategy to the context for the authentication function to use.

### const AUTHENTICATION_METADATA_KEY = MetadataAccessor.create< AuthenticationMetadata, MethodDecorator >('authentication.operationsMetadata')

The key used to store log-related via @loopback/metadata and reflection.

### Class: authmetadataprovider = new AuthMetadataProvider()

Provides authentication metadata of a controller method

#### constructor(controllerClass: Constructor<__type>, methodName: string) : AuthMetadataProvider

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
controllerClass | `Constructor<__type>` |  |  | Provides authentication metadata of a controller method
methodName | `string` |  |  | Provides authentication metadata of a controller method

#### value() : AuthenticationMetadata | undefined

Returns:

AuthenticationMetadata

### Class: strategyadapter = new StrategyAdapter()

#### constructor(strategy: Strategy) : StrategyAdapter

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
strategy | `Strategy` |  |  | instance of a class which implements a passport-strategy

#### authenticate(request: Request) : Promise<UserProfile>

The function to invoke the contained passport strategy. 1. Create an instance of the strategy 2. add success and failure state handlers 3. authenticate using the strategy

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
request | `Request` |  |  | The incoming request.

### Interface: AuthenticateFn

interface definition of a function which accepts a request and returns an authenticated user

### Interface: AuthenticationStrategy

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.

Properties

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
name | `string` |  | exported | The 'name' property is a unique identifier for the authentication strategy ( for example : 'basic', 'jwt', etc)

#### authenticate(request: Request) : Promise<UserProfile | undefined>

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.

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
request | `Request` |  |  |

### Interface: UserProfile

interface definition of a user profile http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

Properties

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
email | `undefined | string` |  | exported optional | interface definition of a user profile http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
id | `string` |  | exported | interface definition of a user profile http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
name | `undefined | string` |  | exported optional | interface definition of a user profile http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

### const AUTHENTICATION_STRATEGY_NOT_FOUND = "AUTHENTICATION_STRATEGY_NOT_FOUND"

### const USER_PROFILE_NOT_FOUND = "USER_PROFILE_NOT_FOUND"

### Function: registerAuthenticationStrategy

#### registerAuthenticationStrategy(context: Context, strategyClass: Constructor<AuthenticationStrategy>) : void

Registers an authentication strategy as an extension of the AuthenticationBindings.AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME extension point.

Parameters

Name | Type | Default Value | Flags | Description
--- | --- | --- | --- | ---
context | `Context` |  |  |
strategyClass | `Constructor<AuthenticationStrategy>` |  |  |