UNPKG

@loopback/docs

Version:

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

86 lines (45 loc) 2.34 kB
--- lang: en title: 'API docs: authentication.userservice' 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.userservice.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/authentication](./authentication.md) &gt; [UserService](./authentication.userservice.md) ## UserService interface A service for performing the login action in an authentication strategy. Usually a client user uses basic credentials to login, or is redirected to a third-party application that grants limited access. 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. Type `C` stands for the type of your credential object. - For local strategy: A typical credential would be: { username: username, password: password } - For oauth strategy: A typical credential would be: { clientId: string; clientSecret: string; callbackURL: string; } It could be read from a local configuration file in the app - For saml strategy: A typical credential would be: { path: string; issuer: string; entryPoint: string; } It could be read from a local configuration file in the app. **Signature:** ```typescript export interface UserService<U, C> ``` ## Methods <table><thead><tr><th> Method </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> [convertToUserProfile(user)](./authentication.userservice.converttouserprofile.md) </td><td markdown="1"> Convert the user returned by `verifyCredentials()` to a common user profile that describes a user in your application </td></tr> <tr><td markdown="1"> [verifyCredentials(credentials)](./authentication.userservice.verifycredentials.md) </td><td markdown="1"> Verify the identity of a user, construct a corresponding user profile using the user information and return the user profile. </td></tr> </tbody></table>