@loopback/docs
Version:
Documentation for LoopBack 4
1,383 lines (1,382 loc) • 45.8 kB
JSON
{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "7.2.1",
"schemaVersion": 1001,
"oldestForwardsCompatibleVersion": 1001
},
"kind": "Package",
"canonicalReference": "@loopback/authentication",
"docComment": "",
"name": "@loopback/authentication",
"members": [
{
"kind": "EntryPoint",
"canonicalReference": "",
"name": "",
"members": [
{
"kind": "Function",
"canonicalReference": "(authenticate:0)",
"docComment": "/**\n * Mark a controller method as requiring authenticated user.\n *\n * @param strategyName - The name of the authentication strategy to use.\n *\n * @param options - Additional options to configure the authentication.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function "
},
{
"kind": "Reference",
"text": "authenticate"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "strategyName"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ", "
},
{
"kind": "Reference",
"text": "options"
},
{
"kind": "Content",
"text": "?: "
},
{
"kind": "Content",
"text": "object"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "MethodDecorator"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 11,
"endIndex": 12
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "strategyName",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
}
},
{
"parameterName": "options",
"parameterTypeTokenRange": {
"startIndex": 9,
"endIndex": 10
}
}
],
"name": "authenticate"
},
{
"kind": "Interface",
"canonicalReference": "(AuthenticateFn:interface)",
"docComment": "/**\n * interface definition of a function which accepts a request and returns an authenticated user\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "AuthenticateFn"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "AuthenticateFn",
"members": [
{
"kind": "CallSignature",
"canonicalReference": "(:call,0)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "request"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "Request"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": " | undefined>"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 9
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "request",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
]
}
],
"extendsTokenRanges": []
},
{
"kind": "Namespace",
"canonicalReference": "(AuthenticationBindings:namespace)",
"docComment": "/**\n * Binding keys used by this component.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare namespace "
},
{
"kind": "Reference",
"text": "AuthenticationBindings"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "AuthenticationBindings",
"members": [
{
"kind": "Variable",
"canonicalReference": "AUTH_ACTION",
"docComment": "/**\n * Key used to inject the authentication function into the sequence.\n *\n * @example\n * ```ts\n * class MySequence implements SequenceHandler {\n * constructor(\n * @inject(AuthenticationBindings.AUTH_ACTION)\n * protected authenticateRequest: AuthenticateFn,\n * // ... other sequence action injections\n * ) {}\n *\n * async handle(context: RequestContext) {\n * try {\n * const {request, response} = context;\n * const route = this.findRoute(request);\n *\n * // Authenticate\n * await this.authenticateRequest(request);\n *\n * // Authentication successful, proceed to invoke controller\n * const args = await this.parseParams(request, route);\n * const result = await this.invoke(route, args);\n * this.send(response, result);\n * } catch (err) {\n * this.reject(context, err);\n * }\n * }\n * }\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "AUTH_ACTION"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "BindingKey"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "AuthenticateFn"
},
{
"kind": "Content",
"text": ">"
}
],
"releaseTag": "Public",
"name": "AUTH_ACTION",
"variableTypeTokenRange": {
"startIndex": 2,
"endIndex": 6
}
},
{
"kind": "Variable",
"canonicalReference": "AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME"
},
{
"kind": "Content",
"text": " = \"authentication.strategies\""
}
],
"releaseTag": "Public",
"name": "AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME",
"variableTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"kind": "Variable",
"canonicalReference": "CURRENT_USER",
"docComment": "/**\n * Key used to inject the user instance retrieved by the authentication function\n *\n * @example\n * ```ts\n * class MyController {\n * constructor(\n * @inject(AuthenticationBindings.CURRENT_USER) private user: UserProfile,\n * ) {}\n *\n * // ... routes that may need authentication\n * ```\n *\n * }\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "CURRENT_USER"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "BindingKey"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": " | undefined>"
}
],
"releaseTag": "Public",
"name": "CURRENT_USER",
"variableTypeTokenRange": {
"startIndex": 2,
"endIndex": 6
}
},
{
"kind": "Variable",
"canonicalReference": "METADATA",
"docComment": "/**\n * Key used to inject authentication metadata, which is used to determine whether a request requires authentication or not.\n *\n * @example\n * ```ts\n * class MyPassportStrategyProvider implements Provider<Strategy | undefined> {\n * constructor(\n * @inject(AuthenticationBindings.METADATA)\n * private metadata: AuthenticationMetadata,\n * ) {}\n * value(): ValueOrPromise<Strategy | undefined> {\n * if (this.metadata) {\n * const name = this.metadata.strategy;\n * // logic to determine which authentication strategy to return\n * }\n * }\n * }\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "METADATA"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "BindingKey"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "AuthenticationMetadata"
},
{
"kind": "Content",
"text": " | undefined>"
}
],
"releaseTag": "Public",
"name": "METADATA",
"variableTypeTokenRange": {
"startIndex": 2,
"endIndex": 6
}
},
{
"kind": "Variable",
"canonicalReference": "STRATEGY",
"docComment": "/**\n * Key used to bind an authentication strategy to the context for the authentication function to use.\n *\n * @example\n * ```ts\n * server\n * .bind(AuthenticationBindings.STRATEGY)\n * .toProvider(MyAuthenticationStrategy);\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "STRATEGY"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "BindingKey"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "AuthenticationStrategy"
},
{
"kind": "Content",
"text": " | undefined>"
}
],
"releaseTag": "Public",
"name": "STRATEGY",
"variableTypeTokenRange": {
"startIndex": 2,
"endIndex": 6
}
}
]
},
{
"kind": "Class",
"canonicalReference": "(AuthenticationComponent:class)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class "
},
{
"kind": "Reference",
"text": "AuthenticationComponent"
},
{
"kind": "Content",
"text": " implements "
},
{
"kind": "Reference",
"text": "Component"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "AuthenticationComponent",
"members": [
{
"kind": "Constructor",
"canonicalReference": "(:constructor,0)",
"docComment": "/**\n * Constructs a new instance of the `AuthenticationComponent` class\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "constructor();"
}
],
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": []
},
{
"kind": "Property",
"canonicalReference": "(providers:instance)",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "providers"
},
{
"kind": "Content",
"text": "?: "
},
{
"kind": "Reference",
"text": "ProviderMap"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "providers",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
},
"isStatic": false
}
],
"implementsTokenRanges": [
{
"startIndex": 3,
"endIndex": 5
}
]
},
{
"kind": "Interface",
"canonicalReference": "(AuthenticationMetadata:interface)",
"docComment": "/**\n * Authentication metadata stored via Reflection API\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "AuthenticationMetadata"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "AuthenticationMetadata",
"members": [
{
"kind": "PropertySignature",
"canonicalReference": "options",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "options"
},
{
"kind": "Content",
"text": "?: "
},
{
"kind": "Content",
"text": "object"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "options",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
},
{
"kind": "PropertySignature",
"canonicalReference": "strategy",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "strategy"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "strategy",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
}
],
"extendsTokenRanges": []
},
{
"kind": "Interface",
"canonicalReference": "(AuthenticationStrategy:interface)",
"docComment": "/**\n * An interface that describes the common authentication strategy.\n *\n * An authentication strategy is a class with an 'authenticate' method that verifies a user's credentials and returns the corresponding user profile.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "AuthenticationStrategy"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "AuthenticationStrategy",
"members": [
{
"kind": "MethodSignature",
"canonicalReference": "(authenticate:0)",
"docComment": "/**\n * 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.\n *\n * @param request - Express request object\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "authenticate"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "request"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "Request"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": " | undefined>"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 10
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "request",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
}
],
"name": "authenticate"
},
{
"kind": "PropertySignature",
"canonicalReference": "name",
"docComment": "/**\n * The 'name' property is a unique identifier for the authentication strategy ( for example : 'basic', 'jwt', etc)\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "name"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "name",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
}
],
"extendsTokenRanges": []
},
{
"kind": "Function",
"canonicalReference": "(getAuthenticateMetadata:0)",
"docComment": "/**\n * Fetch authentication metadata stored by `@authenticate` decorator.\n *\n * @param controllerClass - Target controller\n *\n * @param methodName - Target method\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function "
},
{
"kind": "Reference",
"text": "getAuthenticateMetadata"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "controllerClass"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "Constructor"
},
{
"kind": "Content",
"text": "<{}>"
},
{
"kind": "Content",
"text": ", "
},
{
"kind": "Reference",
"text": "methodName"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "AuthenticationMetadata"
},
{
"kind": "Content",
"text": " | undefined"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 12,
"endIndex": 14
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "controllerClass",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
}
},
{
"parameterName": "methodName",
"parameterTypeTokenRange": {
"startIndex": 10,
"endIndex": 11
}
}
],
"name": "getAuthenticateMetadata"
},
{
"kind": "Function",
"canonicalReference": "(registerAuthenticationStrategy:0)",
"docComment": "/**\n * Registers an authentication strategy as an extension of the AuthenticationBindings.AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME extension point.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function "
},
{
"kind": "Reference",
"text": "registerAuthenticationStrategy"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "context"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "Context"
},
{
"kind": "Content",
"text": ", "
},
{
"kind": "Reference",
"text": "strategyClass"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "Constructor"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "AuthenticationStrategy"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "void"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 14,
"endIndex": 15
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "context",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
}
},
{
"parameterName": "strategyClass",
"parameterTypeTokenRange": {
"startIndex": 9,
"endIndex": 13
}
}
],
"name": "registerAuthenticationStrategy"
},
{
"kind": "Interface",
"canonicalReference": "(TokenService:interface)",
"docComment": "/**\n * An interface for generating and verifying a token\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "TokenService"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "TokenService",
"members": [
{
"kind": "MethodSignature",
"canonicalReference": "(generateToken:0)",
"docComment": "/**\n * Generates a token string based on a user profile\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "generateToken"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "userProfile"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise"
},
{
"kind": "Content",
"text": "<string>"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "userProfile",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
}
],
"name": "generateToken"
},
{
"kind": "MethodSignature",
"canonicalReference": "(verifyToken:0)",
"docComment": "/**\n * Verifies the validity of a token string and returns a user profile\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "verifyToken"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "token"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 10
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "token",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
}
],
"name": "verifyToken"
}
],
"extendsTokenRanges": []
},
{
"kind": "Interface",
"canonicalReference": "(UserProfile:interface)",
"docComment": "/**\n * interface definition of a user profile http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": " "
}
],
"releaseTag": "Public",
"name": "UserProfile",
"members": [
{
"kind": "PropertySignature",
"canonicalReference": "email",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "email"
},
{
"kind": "Content",
"text": "?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "email",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
},
{
"kind": "PropertySignature",
"canonicalReference": "id",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "id"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "id",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
},
{
"kind": "PropertySignature",
"canonicalReference": "name",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "name"
},
{
"kind": "Content",
"text": "?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "name",
"propertyTypeTokenRange": {
"startIndex": 2,
"endIndex": 3
}
}
],
"extendsTokenRanges": []
},
{
"kind": "Interface",
"canonicalReference": "(UserService:interface)",
"docComment": "/**\n * A service for performing the login action in an authentication strategy.\n *\n * Usually a client user uses basic credentials to login, or is redirected to a third-party application that grants limited access.\n *\n * Note: The creation of user is handled in the user controller by calling user repository APIs. For Basic auth, the user has to register first using some endpoint like `/register`. For 3rd-party auth, the user will be created if login is successful and the user doesn't exist in database yet.\n *\n * Type `C` stands for the type of your credential object.\n *\n * - For local strategy:\n *\n * A typical credential would be: { username: username, password: password }\n *\n * - For oauth strategy:\n *\n * A typical credential would be: { clientId: string; clientSecret: string; callbackURL: string; }\n *\n * It could be read from a local configuration file in the app\n *\n * - For saml strategy:\n *\n * A typical credential would be:\n *\n * { path: string; issuer: string; entryPoint: string; }\n *\n * It could be read from a local configuration file in the app.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface "
},
{
"kind": "Reference",
"text": "UserService"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "U"
},
{
"kind": "Content",
"text": ", "
},
{
"kind": "Reference",
"text": "C"
},
{
"kind": "Content",
"text": "> "
}
],
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "U",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "C",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "UserService",
"members": [
{
"kind": "MethodSignature",
"canonicalReference": "(convertToUserProfile:0)",
"docComment": "/**\n * Convert the user returned by `verifyCredentials()` to a common user profile that describes a user in your application\n *\n * @param user - The user returned from `verifyCredentials()`\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "convertToUserProfile"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "user"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "U"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "UserProfile"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "user",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
}
],
"name": "convertToUserProfile"
},
{
"kind": "MethodSignature",
"canonicalReference": "(verifyCredentials:0)",
"docComment": "/**\n * Verify the identity of a user, construct a corresponding user profile using the user information and return the user profile.\n *\n * @param credentials - Credentials for basic auth or configurations for 3rd party. Example see the\n *\n * @example\n *\n * A pseudo code for basic authentication:\n * ```ts\n * verifyCredentials(credentials: C): Promise<U> {\n * // the id field shouldn't be hardcoded\n * user = await UserRepo.find(credentials.id);\n * matched = await passwordService.compare(user.password, credentials.password);\n * if (matched) return user;\n * // throw a JS error, agnostic of the client type\n * throw new Error('authentication failed');\n * };\n * ```\n *\n * A pseudo code for 3rd party authentication:\n * ```ts\n * type UserInfo = {\n * accessToken: string;\n * refreshToken: string;\n * userProfile: string;\n * };\n * verifyCredentials(credentials: C): Promise<U> {\n * try {\n * userInfo: UserInfo = await getUserInfoFromFB(credentials);\n * } catch (e) {\n * // throw a JS error, agnostic of the client type\n * throw e;\n * }\n * };\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "verifyCredentials"
},
{
"kind": "Content",
"text": "("
},
{
"kind": "Reference",
"text": "credentials"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "C"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "U"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 10
},
"releaseTag": "Public",
"overloadIndex": 0,
"parameters": [
{
"parameterName": "credentials",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
}
],
"name": "verifyCredentials"
}
],
"extendsTokenRanges": []
},
{
"kind": "Variable",
"canonicalReference": "AUTHENTICATION_METADATA_KEY",
"docComment": "/**\n * The key used to store log-related via @loopback/metadata and reflection.\n */\n",
"excerptTokens": [
{
"kind": "Reference",
"text": "AUTHENTICATION_METADATA_KEY"
},
{
"kind": "Content",
"text": ": "
},
{
"kind": "Reference",
"text": "MetadataAccessor"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "AuthenticationMetadata"
},
{
"kind": "Content",
"text": ", "
},
{
"kind": "Reference",
"text": "MethodDecorator"
},
{
"kind": "Content",
"text": ">"
}
],
"releaseTag": "Public",
"name": "AUTHENTICATION_METADATA_KEY",
"variableTypeTokenRange": {
"startIndex": 2,
"endIndex": 8
}
},
{
"kind": "Variable",
"canonicalReference": "AUTHENTICATION_STRATEGY_NOT_FOUND",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "AUTHENTICATION_STRATEGY_NOT_FOUND"
},
{
"kind": "Content",
"text": " = \"AUTHENTICATION_STRATEGY_NOT_FOUND\""
}
],
"releaseTag": "Public",
"name": "AUTHENTICATION_STRATEGY_NOT_FOUND",
"variableTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"kind": "Variable",
"canonicalReference": "USER_PROFILE_NOT_FOUND",
"docComment": "",
"excerptTokens": [
{
"kind": "Reference",
"text": "USER_PROFILE_NOT_FOUND"
},
{
"kind": "Content",
"text": " = \"USER_PROFILE_NOT_FOUND\""
}
],
"releaseTag": "Public",
"name": "USER_PROFILE_NOT_FOUND",
"variableTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
]
}
]
}