Page Contents

Home > @loopback/authentication > UserIdentityService

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:

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) find or create a local user using a profile from an external source
linkExternalProfile(userId, userIdentity) link an external profile with an existing local user id.