@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
36 lines (23 loc) • 1.72 kB
Markdown
---
lang: en
title: 'API docs: authentication.useridentityservice'
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.useridentityservice.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/authentication](./authentication.md) > [UserIdentityService](./authentication.useridentityservice.md)
## UserIdentityService interface
The User Identity service links a user to profiles from an external source (eg: ldap, oauth2 provider, saml) which can identify the user. The profile typically has the following information: name, email-id, uuid, roles, authorizations, scope of accessible resources, expiration time for given access
<b>Signature:</b>
```typescript
export interface UserIdentityService<I, U>
```
## Example
export class LDAPUserIdentityService implements UserIdentityService<!-- --><<!-- -->LDAPUserIdentity, UserProfile<!-- -->> { constructor( @<!-- -->repository(UserRepository) public userRepository: UserRepository, @<!-- -->repository(UserIdentityRepository) public userIdentityRepository: UserIdentityRepository, ) {<!-- -->} }
## Methods
| Method | Description |
| --- | --- |
| [findOrCreateUser(userIdentity)](./authentication.useridentityservice.findorcreateuser.md) | find or create a local user using a profile from an external source |
| [linkExternalProfile(userId, userIdentity)](./authentication.useridentityservice.linkexternalprofile.md) | link an external profile with an existing local user id. |