|
|
@@ -1,7 +1,7 @@
|
|
|
---
|
|
|
title: "ExternalAuthenticationService"
|
|
|
weight: 10
|
|
|
-date: 2023-07-04T11:02:12.918Z
|
|
|
+date: 2023-07-14T16:57:50.228Z
|
|
|
showtoc: true
|
|
|
generated: true
|
|
|
---
|
|
|
@@ -15,7 +15,7 @@ generated: true
|
|
|
|
|
|
{{< generation-info sourceFile="packages/core/src/service/helpers/external-authentication/external-authentication.service.ts" sourceLine="24" packageName="@vendure/core">}}
|
|
|
|
|
|
-This is a helper service which exposes methods related to looking up and creating Users based on an
|
|
|
+This is a helper service which exposes methods related to looking up and creating Users based on an
|
|
|
external <a href='/typescript-api/auth/authentication-strategy#authenticationstrategy'>AuthenticationStrategy</a>.
|
|
|
|
|
|
## Signature
|
|
|
@@ -25,22 +25,22 @@ class ExternalAuthenticationService {
|
|
|
constructor(connection: TransactionalConnection, roleService: RoleService, historyService: HistoryService, customerService: CustomerService, administratorService: AdministratorService, channelService: ChannelService)
|
|
|
async findCustomerUser(ctx: RequestContext, strategy: string, externalIdentifier: string, checkCurrentChannelOnly: = true) => 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;
|
|
|
+ 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 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>;
|
|
|
}
|
|
|
@@ -57,35 +57,35 @@ class ExternalAuthenticationService {
|
|
|
|
|
|
{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, strategy: string, externalIdentifier: string, checkCurrentChannelOnly: = true) => Promise<<a href='/typescript-api/entities/user#user'>User</a> | undefined>" >}}
|
|
|
|
|
|
-{{< member-description >}}Looks up a User based on their identifier from an external authentication
|
|
|
-provider, ensuring this User is associated with a Customer account.
|
|
|
-
|
|
|
-By default, only customers in the currently-active Channel will be checked.
|
|
|
-By passing `false` as the `checkCurrentChannelOnly` argument, _all_ channels
|
|
|
+{{< member-description >}}Looks up a User based on their identifier from an external authentication
|
|
|
+provider, ensuring this User is associated with a Customer account.
|
|
|
+
|
|
|
+By default, only customers in the currently-active Channel will be checked.
|
|
|
+By passing `false` as the `checkCurrentChannelOnly` argument, _all_ channels
|
|
|
will be checked.{{< /member-description >}}
|
|
|
|
|
|
### findAdministratorUser
|
|
|
|
|
|
{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, strategy: string, externalIdentifier: string) => Promise<<a href='/typescript-api/entities/user#user'>User</a> | undefined>" >}}
|
|
|
|
|
|
-{{< member-description >}}Looks up a User based on their identifier from an external authentication
|
|
|
+{{< member-description >}}Looks up a User based on their identifier from an external authentication
|
|
|
provider, ensuring this User is associated with an Administrator account.{{< /member-description >}}
|
|
|
|
|
|
### createCustomerAndUser
|
|
|
|
|
|
-{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, config: {
strategy: string;
externalIdentifier: string;
verified: boolean;
emailAddress: string;
firstName?: string;
lastName?: string;
}) => Promise<<a href='/typescript-api/entities/user#user'>User</a>>" >}}
|
|
|
+{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, config: { strategy: string; externalIdentifier: string; verified: boolean; emailAddress: string; firstName?: string; lastName?: string; }) => Promise<<a href='/typescript-api/entities/user#user'>User</a>>" >}}
|
|
|
|
|
|
-{{< member-description >}}If a customer has been successfully authenticated by an external authentication provider, yet cannot
|
|
|
-be found using `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
|
|
|
+{{< member-description >}}If a customer has been successfully authenticated by an external authentication provider, yet cannot
|
|
|
+be found using `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.{{< /member-description >}}
|
|
|
|
|
|
### createAdministratorAndUser
|
|
|
|
|
|
-{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, config: {
strategy: string;
externalIdentifier: string;
identifier: string;
emailAddress?: string;
firstName?: string;
lastName?: string;
roles: <a href='/typescript-api/entities/role#role'>Role</a>[];
}) => " >}}
|
|
|
+{{< member-info kind="method" type="(ctx: <a href='/typescript-api/request/request-context#requestcontext'>RequestContext</a>, config: { strategy: string; externalIdentifier: string; identifier: string; emailAddress?: string; firstName?: string; lastName?: string; roles: <a href='/typescript-api/entities/role#role'>Role</a>[]; }) => " >}}
|
|
|
|
|
|
-{{< member-description >}}If an administrator has been successfully authenticated by an external authentication provider, yet cannot
|
|
|
-be found using `findAdministratorUser`, then we need to create a new User and
|
|
|
+{{< member-description >}}If an administrator has been successfully authenticated by an external authentication provider, yet cannot
|
|
|
+be found using `findAdministratorUser`, then we need to create a new User and
|
|
|
Administrator record in Vendure for that user.{{< /member-description >}}
|
|
|
|
|
|
### findUser
|