ExternalAuthenticationService
ExternalAuthenticationService
This is a helper service which exposes methods related to looking up and creating Users based on an external AuthenticationStrategy.
Signature
class ExternalAuthenticationService {
constructor(connection: TransactionalConnection, roleService: RoleService, historyService: HistoryService, customerService: CustomerService, administratorService: AdministratorService, channelService: ChannelService)
async findCustomerUser(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>;
async findAdministratorUser(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>;
async createCustomerAndUser(ctx: RequestContext, config: {
strategy: string;
externalIdentifier: string;
verified: boolean;
emailAddress: string;
firstName?: string;
lastName?: string;
}) => Promise<User>;
async createAdministratorAndUser(ctx: RequestContext, config: {
strategy: string;
externalIdentifier: string;
identifier: string;
emailAddress?: string;
firstName?: string;
lastName?: string;
roles: Role[];
}) => ;
async findUser(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>;
}
Members
constructor
(connection: TransactionalConnection, roleService: RoleService, historyService: HistoryService, customerService: CustomerService, administratorService: AdministratorService, channelService: ChannelService) => ExternalAuthenticationService
findCustomerUser
(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>
findAdministratorUser
(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>
createCustomerAndUser
(ctx: RequestContext, config: { strategy: string; externalIdentifier: string; verified: boolean; emailAddress: string; firstName?: string; lastName?: string; }) => Promise<User>
findCustomerUser
, then we need to create a new User and
Customer record in Vendure for that user. This method encapsulates that logic as well as additional
housekeeping such as adding a record to the Customer’s history.
createAdministratorAndUser
(ctx: RequestContext, config: { strategy: string; externalIdentifier: string; identifier: string; emailAddress?: string; firstName?: string; lastName?: string; roles: Role[]; }) =>
findAdministratorUser
, then we need to create a new User and
Administrator record in Vendure for that user.
findUser
(ctx: RequestContext, strategy: string, externalIdentifier: string) => Promise<User | undefined>