---
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) &gt; [@loopback/authentication](./authentication.md) &gt; [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

**Signature:**

```typescript
export interface UserIdentityService<I, U> 
```

## Example

export class LDAPUserIdentityService implements UserIdentityService<!-- -->&lt;<!-- -->LDAPUserIdentity, UserProfile<!-- -->&gt; { 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. |


