---
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

<table><thead><tr><th>

Method


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

[findOrCreateUser(userIdentity)](./authentication.useridentityservice.findorcreateuser.md)


</td><td markdown="1">

find or create a local user using a profile from an external source


</td></tr>
<tr><td markdown="1">

[linkExternalProfile(userId, userIdentity)](./authentication.useridentityservice.linkexternalprofile.md)


</td><td markdown="1">

link an external profile with an existing local user id.


</td></tr>
</tbody></table>


