Page Contents
Home > @loopback/authentication > AuthenticationBindings > METADATA
AuthenticationBindings.METADATA variable
Key used to inject authentication metadata, which is used to determine whether a request requires authentication or not.
Signature:
METADATA: BindingKey<AuthenticationMetadata[] | undefined>
Example
class MyPassportStrategyProvider implements Provider<Strategy | undefined> {
constructor(
@inject(AuthenticationBindings.METADATA)
private metadata?: AuthenticationMetadata[],
) {}
value(): ValueOrPromise<Strategy | undefined> {
if (this.metadata?.length) {
// logic to determine which authentication strategy to return
}
}
}