@axinom/mosaic-user-auth 0.4.4 → 0.5.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/UserServiceClient/UserServiceClient.d.ts +12 -12
- package/dist/UserServiceClient/UserServiceClient.d.ts.map +1 -1
- package/dist/common/types.d.ts +4 -4
- package/dist/common/types.d.ts.map +1 -1
- package/dist/index.es.js +65 -59
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +65 -59
- package/dist/index.js.map +1 -1
- package/dist/util/userAuth.d.ts +5 -5
- package/dist/util/userAuth.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CheckPasswordResetOtpResponse, CheckUserSignUpOtpResponse, CompletePasswordResetResponse, CompleteUserSignUpResponse, DecryptNativeCookieResponse, IdpConfiguration, InitiatePasswordResetResponse,
|
|
1
|
+
import { CheckPasswordResetOtpResponse, CheckUserSignUpOtpResponse, CompletePasswordResetResponse, CompleteUserSignUpResponse, DecryptNativeCookieResponse, IdpConfiguration, InitiatePasswordResetResponse, SignInResponse, UserSignUpResponse } from '@axinom/mosaic-user-auth-utils';
|
|
2
2
|
import { CheckEndUserPasswordResetOtpInput, CheckEndUserSignUpOtpInput, CompleteEndUserPasswordResetInput, CompleteEndUserSignUpInput, InitiateEndUserSignUpInput } from 'generated/ax-auth-management-graphql.types';
|
|
3
3
|
import { AuthenticateEndUserApplicationInput } from 'generated/user-service-management-graphql.types';
|
|
4
4
|
import { TokenRenewalMethod } from '../common/enums';
|
|
5
|
-
import { AuthenticateEndUserApplicationResponse,
|
|
5
|
+
import { AuthenticateEndUserApplicationResponse, SignInRequest, TokenChangedCallback, TokenResponse, UserAuthConfig, UserProfileActivateResponse, UserProfileCreateResponse, UserProfileDeleteResponse, UserProfileResponse, UserProfilesResponse, UserProfileUpdateInput, UserProfileUpdateResponse, UserServiceConfig } from '../common/types';
|
|
6
6
|
export interface IUserServiceClient {
|
|
7
7
|
isDirectSignInConfigured(): Promise<boolean>;
|
|
8
|
-
|
|
8
|
+
signInWithCredentials(signInRequest: SignInRequest): Promise<SignInResponse>;
|
|
9
9
|
initiateUserSignUp(userSignUpRequest: Omit<InitiateEndUserSignUpInput, 'oAuthClientId'>): Promise<UserSignUpResponse>;
|
|
10
10
|
checkUserSignUpOTP(checkUserSignUpOtpRequest: CheckEndUserSignUpOtpInput): Promise<CheckUserSignUpOtpResponse>;
|
|
11
11
|
completeUserSignUp(completeUserSignUpRequest: CompleteEndUserSignUpInput): Promise<CompleteUserSignUpResponse>;
|
|
@@ -34,7 +34,7 @@ export declare class UserServiceClient implements IUserServiceClient {
|
|
|
34
34
|
private tokenRenewalMethod;
|
|
35
35
|
private _tokenChangedHandlers;
|
|
36
36
|
private _tokenResponse;
|
|
37
|
-
private
|
|
37
|
+
private _signInWithCredentialsEndpointResponse;
|
|
38
38
|
private _axAuthIdpConfig;
|
|
39
39
|
/**
|
|
40
40
|
* Creates a user service client. For performance reasons there should only be a single client instance created by an application
|
|
@@ -52,9 +52,9 @@ export declare class UserServiceClient implements IUserServiceClient {
|
|
|
52
52
|
private fetchToken;
|
|
53
53
|
/**
|
|
54
54
|
* Call the well-known endpoint of ax-user-service and retrieves endpoints related to AxAuth.
|
|
55
|
-
* @returns
|
|
55
|
+
* @returns SignInWithCredentialsEndpointResponse
|
|
56
56
|
*/
|
|
57
|
-
private
|
|
57
|
+
private getSignInWithCredentialsEndpoints;
|
|
58
58
|
private _recursiveRefreshActive;
|
|
59
59
|
/**
|
|
60
60
|
* Renews the token pre-emptively by recursively refreshing the cached token just before it's expiry
|
|
@@ -65,18 +65,18 @@ export declare class UserServiceClient implements IUserServiceClient {
|
|
|
65
65
|
* Based on the outcome of this function, an end-user application can conditionally offer the option to Sign-In directly
|
|
66
66
|
* via email & password.
|
|
67
67
|
*
|
|
68
|
-
* @see {@link
|
|
68
|
+
* @see {@link signInWithCredentials}
|
|
69
69
|
*
|
|
70
70
|
* @returns a boolean indicating if the Mosaic application has an AxAuth IDP provider configured and it is enabled.
|
|
71
71
|
*/
|
|
72
72
|
isDirectSignInConfigured: () => Promise<boolean>;
|
|
73
73
|
/**
|
|
74
|
-
* Starts a
|
|
74
|
+
* Starts a SignInWithCredentials flow using the AX_AUTH IDP configured for the application.
|
|
75
75
|
*
|
|
76
|
-
* @param
|
|
77
|
-
* @returns `
|
|
76
|
+
* @param signInRequest
|
|
77
|
+
* @returns `SignInResponse`
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
signInWithCredentials: (signInRequest: SignInRequest) => Promise<SignInResponse>;
|
|
80
80
|
/**
|
|
81
81
|
* Registers a new user in the AX_AUTH IDP configured for the application.
|
|
82
82
|
*
|
|
@@ -142,7 +142,7 @@ export declare class UserServiceClient implements IUserServiceClient {
|
|
|
142
142
|
removeTokenChangedHandler: (callback: TokenChangedCallback) => void;
|
|
143
143
|
/**
|
|
144
144
|
* Returns an array of IDP Configurations that are configured for the application
|
|
145
|
-
* This list will exclude connections for provider id AX_AUTH as it is used for a user sign-up and
|
|
145
|
+
* This list will exclude connections for provider id AX_AUTH as it is used for a user sign-up and SignInWithCredentials flows.
|
|
146
146
|
*
|
|
147
147
|
*/
|
|
148
148
|
getIdpConfigurations: () => Promise<IdpConfiguration[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserServiceClient.d.ts","sourceRoot":"","sources":["../../src/UserServiceClient/UserServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAE1B,2BAA2B,EAC3B,gBAAgB,EAChB,6BAA6B,EAE7B,
|
|
1
|
+
{"version":3,"file":"UserServiceClient.d.ts","sourceRoot":"","sources":["../../src/UserServiceClient/UserServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAE1B,2BA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
|
package/dist/common/types.d.ts
CHANGED
|
@@ -60,16 +60,16 @@ export interface TokenResponse {
|
|
|
60
60
|
nextTokenRenewalAt?: Date;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Represents the information required to perform a
|
|
63
|
+
* Represents the information required to perform a SignInWithCredentials flow.
|
|
64
64
|
*/
|
|
65
|
-
export interface
|
|
65
|
+
export interface SignInRequest {
|
|
66
66
|
email: string;
|
|
67
67
|
password: string;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Represents the response for the request to retrieve
|
|
70
|
+
* Represents the response for the request to retrieve SignInWithCredentials endpoints.
|
|
71
71
|
*/
|
|
72
|
-
export interface
|
|
72
|
+
export interface SignInWithCredentialsEndpointResponse {
|
|
73
73
|
code: 'SUCCESS' | 'ERROR';
|
|
74
74
|
managementEndpoint?: string;
|
|
75
75
|
authEndpoint?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IAC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AE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sCAAsC;IACrD,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/index.es.js
CHANGED
|
@@ -56,7 +56,7 @@ function commonjsRequire () {
|
|
|
56
56
|
|
|
57
57
|
var enums = createCommonjsModule(function (module, exports) {
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.DecryptNativeCookieResponseCode = exports.IdpProtocol = exports.CheckOtpResponseCode = exports.CompleteUserSignUpResponseCode = exports.UserSignUpResponseCode = exports.
|
|
59
|
+
exports.DecryptNativeCookieResponseCode = exports.IdpProtocol = exports.CheckOtpResponseCode = exports.CompleteUserSignUpResponseCode = exports.UserSignUpResponseCode = exports.ResetPasswordResponseCode = exports.SignInResponseCode = exports.IdpConfigurationResponseCode = exports.SignOutResponseCode = exports.TokenResponseCode = void 0;
|
|
60
60
|
/**
|
|
61
61
|
* Token response code from User Service Auth API
|
|
62
62
|
*/
|
|
@@ -91,27 +91,27 @@ var IdpConfigurationResponseCode;
|
|
|
91
91
|
IdpConfigurationResponseCode["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
|
|
92
92
|
})(IdpConfigurationResponseCode = exports.IdpConfigurationResponseCode || (exports.IdpConfigurationResponseCode = {}));
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Sign In With Credentials Response Code from User Service Auth API
|
|
95
95
|
*/
|
|
96
|
-
var
|
|
97
|
-
(function (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})(
|
|
96
|
+
var SignInResponseCode;
|
|
97
|
+
(function (SignInResponseCode) {
|
|
98
|
+
SignInResponseCode["SUCCESS"] = "SUCCESS";
|
|
99
|
+
SignInResponseCode["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
|
|
100
|
+
SignInResponseCode["BAD_REQUEST"] = "BAD_REQUEST";
|
|
101
|
+
SignInResponseCode["AUTH_FLOW_ERROR"] = "AUTH_FLOW_ERROR";
|
|
102
|
+
SignInResponseCode["SERVICE_CONFIGURATION_ERROR"] = "SERVICE_CONFIGURATION_ERROR";
|
|
103
|
+
})(SignInResponseCode = exports.SignInResponseCode || (exports.SignInResponseCode = {}));
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Sign In With Credentials Password Reset/Complete Password Reset Code from User Service Auth API
|
|
106
106
|
*/
|
|
107
|
-
var
|
|
108
|
-
(function (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})(
|
|
107
|
+
var ResetPasswordResponseCode;
|
|
108
|
+
(function (ResetPasswordResponseCode) {
|
|
109
|
+
ResetPasswordResponseCode["SUCCESS"] = "SUCCESS";
|
|
110
|
+
ResetPasswordResponseCode["ERROR"] = "ERROR";
|
|
111
|
+
ResetPasswordResponseCode["SERVICE_CONFIGURATION_ERROR"] = "SERVICE_CONFIGURATION_ERROR";
|
|
112
|
+
})(ResetPasswordResponseCode = exports.ResetPasswordResponseCode || (exports.ResetPasswordResponseCode = {}));
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Sign Up With Credential Response Code from User Service Auth API
|
|
115
115
|
*/
|
|
116
116
|
var UserSignUpResponseCode;
|
|
117
117
|
(function (UserSignUpResponseCode) {
|
|
@@ -120,7 +120,7 @@ var UserSignUpResponseCode;
|
|
|
120
120
|
UserSignUpResponseCode["SERVICE_CONFIGURATION_ERROR"] = "SERVICE_CONFIGURATION_ERROR";
|
|
121
121
|
})(UserSignUpResponseCode = exports.UserSignUpResponseCode || (exports.UserSignUpResponseCode = {}));
|
|
122
122
|
/**
|
|
123
|
-
* Verify
|
|
123
|
+
* Verify Sign Up With Credential Response Code from User Service Auth API
|
|
124
124
|
*/
|
|
125
125
|
var CompleteUserSignUpResponseCode;
|
|
126
126
|
(function (CompleteUserSignUpResponseCode) {
|
|
@@ -1657,15 +1657,15 @@ const getWellKnownEndpoints = (userAuthConfig) => __awaiter(void 0, void 0, void
|
|
|
1657
1657
|
return userServiceEndpoints;
|
|
1658
1658
|
});
|
|
1659
1659
|
/**
|
|
1660
|
-
* Perform a user sign in process according to the
|
|
1660
|
+
* Perform a user sign in process according to the SignInWithCredentials flow.
|
|
1661
1661
|
*
|
|
1662
1662
|
* @param userAuthConfig An object containing user authentication info.
|
|
1663
1663
|
* @param axAuthConnectionId The IDP Connection ID for AX_AUTH as configured for the application.
|
|
1664
|
-
* @param
|
|
1664
|
+
* @param signInRequest Sign info (email, password).
|
|
1665
1665
|
* @returns
|
|
1666
1666
|
*/
|
|
1667
|
-
const
|
|
1668
|
-
const signInURL = new URL(`${userAuthConfig.tenantId}/${userAuthConfig.environmentId}/${userAuthConfig.applicationId}/
|
|
1667
|
+
const performSignInWithCredentials = (userAuthConfig, axAuthConnectionId, signInRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1668
|
+
const signInURL = new URL(`${userAuthConfig.tenantId}/${userAuthConfig.environmentId}/${userAuthConfig.applicationId}/sign-in-with-credentials`, userAuthConfig.userAuthBaseUrl);
|
|
1669
1669
|
const signInResponse = yield (yield fetch(signInURL.href, {
|
|
1670
1670
|
method: 'POST',
|
|
1671
1671
|
cache: 'no-cache',
|
|
@@ -1675,7 +1675,7 @@ const performROPCSignIn = (userAuthConfig, axAuthConnectionId, ropcSignInRequest
|
|
|
1675
1675
|
headers: {
|
|
1676
1676
|
'Content-Type': 'application/json',
|
|
1677
1677
|
},
|
|
1678
|
-
body: JSON.stringify(Object.assign(Object.assign({},
|
|
1678
|
+
body: JSON.stringify(Object.assign(Object.assign({}, signInRequest), { connectionId: axAuthConnectionId })),
|
|
1679
1679
|
})).json();
|
|
1680
1680
|
return signInResponse;
|
|
1681
1681
|
});
|
|
@@ -1803,12 +1803,12 @@ const initiatePasswordReset = (email, axAuthClientId, axAuthManagementEndpoint)
|
|
|
1803
1803
|
})).json();
|
|
1804
1804
|
if (initiateResetPasswordResponse.errors !== undefined) {
|
|
1805
1805
|
return {
|
|
1806
|
-
code: dist.
|
|
1806
|
+
code: dist.ResetPasswordResponseCode.ERROR,
|
|
1807
1807
|
message: initiateResetPasswordResponse.errors[0].message,
|
|
1808
1808
|
};
|
|
1809
1809
|
}
|
|
1810
1810
|
return {
|
|
1811
|
-
code: dist.
|
|
1811
|
+
code: dist.ResetPasswordResponseCode.SUCCESS,
|
|
1812
1812
|
};
|
|
1813
1813
|
});
|
|
1814
1814
|
/**
|
|
@@ -1869,12 +1869,12 @@ const completePasswordReset = (completePasswordResetRequest, axAuthManagementEnd
|
|
|
1869
1869
|
})).json();
|
|
1870
1870
|
if (completePasswordResetResponse.errors !== undefined) {
|
|
1871
1871
|
return {
|
|
1872
|
-
code: dist.
|
|
1872
|
+
code: dist.ResetPasswordResponseCode.ERROR,
|
|
1873
1873
|
message: completePasswordResetResponse.errors[0].message,
|
|
1874
1874
|
};
|
|
1875
1875
|
}
|
|
1876
1876
|
return {
|
|
1877
|
-
code: dist.
|
|
1877
|
+
code: dist.ResetPasswordResponseCode.SUCCESS,
|
|
1878
1878
|
};
|
|
1879
1879
|
});
|
|
1880
1880
|
const getIdpConfigurations = (userAuthConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -2264,7 +2264,7 @@ class UserServiceClient {
|
|
|
2264
2264
|
this.tokenRenewalMethod = tokenRenewalMethod;
|
|
2265
2265
|
this._tokenChangedHandlers = [];
|
|
2266
2266
|
this._tokenResponse = null;
|
|
2267
|
-
this.
|
|
2267
|
+
this._signInWithCredentialsEndpointResponse = null;
|
|
2268
2268
|
this.emitTokenChanged = (token) => {
|
|
2269
2269
|
this._tokenChangedHandlers.forEach((handler) => handler(token));
|
|
2270
2270
|
};
|
|
@@ -2295,19 +2295,19 @@ class UserServiceClient {
|
|
|
2295
2295
|
});
|
|
2296
2296
|
/**
|
|
2297
2297
|
* Call the well-known endpoint of ax-user-service and retrieves endpoints related to AxAuth.
|
|
2298
|
-
* @returns
|
|
2298
|
+
* @returns SignInWithCredentialsEndpointResponse
|
|
2299
2299
|
*/
|
|
2300
|
-
this.
|
|
2300
|
+
this.getSignInWithCredentialsEndpoints = () => __awaiter(this, void 0, void 0, function* () {
|
|
2301
2301
|
try {
|
|
2302
|
-
if (this.
|
|
2302
|
+
if (this._signInWithCredentialsEndpointResponse === null) {
|
|
2303
2303
|
const endpoints = yield getWellKnownEndpoints(this.userAuthConfig);
|
|
2304
|
-
this.
|
|
2304
|
+
this._signInWithCredentialsEndpointResponse = {
|
|
2305
2305
|
code: 'SUCCESS',
|
|
2306
2306
|
managementEndpoint: endpoints.axAuthManagementGQL,
|
|
2307
2307
|
authEndpoint: endpoints.axAuthEndpoint,
|
|
2308
2308
|
};
|
|
2309
2309
|
}
|
|
2310
|
-
return this.
|
|
2310
|
+
return this._signInWithCredentialsEndpointResponse;
|
|
2311
2311
|
}
|
|
2312
2312
|
catch (error) {
|
|
2313
2313
|
assertError(error);
|
|
@@ -2340,7 +2340,7 @@ class UserServiceClient {
|
|
|
2340
2340
|
* Based on the outcome of this function, an end-user application can conditionally offer the option to Sign-In directly
|
|
2341
2341
|
* via email & password.
|
|
2342
2342
|
*
|
|
2343
|
-
* @see {@link
|
|
2343
|
+
* @see {@link signInWithCredentials}
|
|
2344
2344
|
*
|
|
2345
2345
|
* @returns a boolean indicating if the Mosaic application has an AxAuth IDP provider configured and it is enabled.
|
|
2346
2346
|
*/
|
|
@@ -2350,21 +2350,21 @@ class UserServiceClient {
|
|
|
2350
2350
|
return this._axAuthIdpConfig !== undefined;
|
|
2351
2351
|
});
|
|
2352
2352
|
/**
|
|
2353
|
-
* Starts a
|
|
2353
|
+
* Starts a SignInWithCredentials flow using the AX_AUTH IDP configured for the application.
|
|
2354
2354
|
*
|
|
2355
|
-
* @param
|
|
2356
|
-
* @returns `
|
|
2355
|
+
* @param signInRequest
|
|
2356
|
+
* @returns `SignInResponse`
|
|
2357
2357
|
*/
|
|
2358
|
-
this.
|
|
2358
|
+
this.signInWithCredentials = (signInRequest) => __awaiter(this, void 0, void 0, function* () {
|
|
2359
2359
|
var _b, _c;
|
|
2360
2360
|
if (((_b = this._axAuthIdpConfig) === null || _b === void 0 ? void 0 : _b.idpConnectionId) !== undefined) {
|
|
2361
|
-
const result = yield
|
|
2361
|
+
const result = yield performSignInWithCredentials(this.userAuthConfig, (_c = this._axAuthIdpConfig) === null || _c === void 0 ? void 0 : _c.idpConnectionId, signInRequest);
|
|
2362
2362
|
return result;
|
|
2363
2363
|
}
|
|
2364
2364
|
else {
|
|
2365
2365
|
return {
|
|
2366
|
-
code: dist.
|
|
2367
|
-
message: 'No IDP has configured for
|
|
2366
|
+
code: dist.SignInResponseCode.SERVICE_CONFIGURATION_ERROR,
|
|
2367
|
+
message: 'No IDP has configured for sign in with credentials.',
|
|
2368
2368
|
};
|
|
2369
2369
|
}
|
|
2370
2370
|
});
|
|
@@ -2382,9 +2382,10 @@ class UserServiceClient {
|
|
|
2382
2382
|
}
|
|
2383
2383
|
if (this._axAuthIdpConfig !== undefined &&
|
|
2384
2384
|
this._axAuthIdpConfig.clientId !== null &&
|
|
2385
|
-
((_d = this.
|
|
2385
|
+
((_d = this._signInWithCredentialsEndpointResponse) === null || _d === void 0 ? void 0 : _d.managementEndpoint) !==
|
|
2386
|
+
undefined) {
|
|
2386
2387
|
const signUpRequest = Object.assign(Object.assign({}, userSignUpRequest), { oAuthClientId: this._axAuthIdpConfig.clientId });
|
|
2387
|
-
const result = yield initiateUserSignUp(signUpRequest, this.
|
|
2388
|
+
const result = yield initiateUserSignUp(signUpRequest, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2388
2389
|
return result;
|
|
2389
2390
|
}
|
|
2390
2391
|
else {
|
|
@@ -2408,8 +2409,9 @@ class UserServiceClient {
|
|
|
2408
2409
|
}
|
|
2409
2410
|
if (this._axAuthIdpConfig !== undefined &&
|
|
2410
2411
|
this._axAuthIdpConfig.clientId !== null &&
|
|
2411
|
-
((_e = this.
|
|
2412
|
-
|
|
2412
|
+
((_e = this._signInWithCredentialsEndpointResponse) === null || _e === void 0 ? void 0 : _e.managementEndpoint) !==
|
|
2413
|
+
undefined) {
|
|
2414
|
+
const result = yield checkUserSignUpOtp(checkUserSignUpOtpRequest, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2413
2415
|
return result;
|
|
2414
2416
|
}
|
|
2415
2417
|
else {
|
|
@@ -2429,8 +2431,9 @@ class UserServiceClient {
|
|
|
2429
2431
|
*/
|
|
2430
2432
|
this.completeUserSignUp = (completeUserSignUpRequest) => __awaiter(this, void 0, void 0, function* () {
|
|
2431
2433
|
var _f;
|
|
2432
|
-
if (((_f = this.
|
|
2433
|
-
|
|
2434
|
+
if (((_f = this._signInWithCredentialsEndpointResponse) === null || _f === void 0 ? void 0 : _f.managementEndpoint) !==
|
|
2435
|
+
undefined) {
|
|
2436
|
+
const result = yield completeUserSignUp(completeUserSignUpRequest, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2434
2437
|
return result;
|
|
2435
2438
|
}
|
|
2436
2439
|
else {
|
|
@@ -2456,13 +2459,14 @@ class UserServiceClient {
|
|
|
2456
2459
|
}
|
|
2457
2460
|
if (this._axAuthIdpConfig !== undefined &&
|
|
2458
2461
|
this._axAuthIdpConfig.clientId !== null &&
|
|
2459
|
-
((_g = this.
|
|
2460
|
-
|
|
2462
|
+
((_g = this._signInWithCredentialsEndpointResponse) === null || _g === void 0 ? void 0 : _g.managementEndpoint) !==
|
|
2463
|
+
undefined) {
|
|
2464
|
+
const result = yield initiatePasswordReset(email, this._axAuthIdpConfig.clientId, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2461
2465
|
return result;
|
|
2462
2466
|
}
|
|
2463
2467
|
else {
|
|
2464
2468
|
return {
|
|
2465
|
-
code: dist.
|
|
2469
|
+
code: dist.ResetPasswordResponseCode.SERVICE_CONFIGURATION_ERROR,
|
|
2466
2470
|
message: 'No IDP has been configured to handle password reset.',
|
|
2467
2471
|
};
|
|
2468
2472
|
}
|
|
@@ -2481,8 +2485,9 @@ class UserServiceClient {
|
|
|
2481
2485
|
}
|
|
2482
2486
|
if (this._axAuthIdpConfig !== undefined &&
|
|
2483
2487
|
this._axAuthIdpConfig.clientId !== null &&
|
|
2484
|
-
((_h = this.
|
|
2485
|
-
|
|
2488
|
+
((_h = this._signInWithCredentialsEndpointResponse) === null || _h === void 0 ? void 0 : _h.managementEndpoint) !==
|
|
2489
|
+
undefined) {
|
|
2490
|
+
const result = yield checkPasswordResetOtp(checkPasswordResetOtpRequest, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2486
2491
|
return result;
|
|
2487
2492
|
}
|
|
2488
2493
|
else {
|
|
@@ -2501,13 +2506,14 @@ class UserServiceClient {
|
|
|
2501
2506
|
*/
|
|
2502
2507
|
this.completeResetPassword = (completePasswordResetRequest) => __awaiter(this, void 0, void 0, function* () {
|
|
2503
2508
|
var _j;
|
|
2504
|
-
if (((_j = this.
|
|
2505
|
-
|
|
2509
|
+
if (((_j = this._signInWithCredentialsEndpointResponse) === null || _j === void 0 ? void 0 : _j.managementEndpoint) !==
|
|
2510
|
+
undefined) {
|
|
2511
|
+
const result = yield completePasswordReset(completePasswordResetRequest, this._signInWithCredentialsEndpointResponse.managementEndpoint);
|
|
2506
2512
|
return result;
|
|
2507
2513
|
}
|
|
2508
2514
|
else {
|
|
2509
2515
|
return {
|
|
2510
|
-
code: dist.
|
|
2516
|
+
code: dist.ResetPasswordResponseCode.SERVICE_CONFIGURATION_ERROR,
|
|
2511
2517
|
message: 'No IDP has been configured to handle password reset.',
|
|
2512
2518
|
};
|
|
2513
2519
|
}
|
|
@@ -2554,7 +2560,7 @@ class UserServiceClient {
|
|
|
2554
2560
|
};
|
|
2555
2561
|
/**
|
|
2556
2562
|
* Returns an array of IDP Configurations that are configured for the application
|
|
2557
|
-
* This list will exclude connections for provider id AX_AUTH as it is used for a user sign-up and
|
|
2563
|
+
* This list will exclude connections for provider id AX_AUTH as it is used for a user sign-up and SignInWithCredentials flows.
|
|
2558
2564
|
*
|
|
2559
2565
|
*/
|
|
2560
2566
|
this.getIdpConfigurations = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2693,8 +2699,8 @@ class UserServiceClient {
|
|
|
2693
2699
|
const authUrl = getNativeAuthUrl(this.userAuthConfig, idpConnectionId, returnUrl, encryptionKey);
|
|
2694
2700
|
return authUrl;
|
|
2695
2701
|
};
|
|
2696
|
-
// asynchronously get the
|
|
2697
|
-
this.
|
|
2702
|
+
// asynchronously get the SignInWithCredentials endpoints at client initialization
|
|
2703
|
+
this.getSignInWithCredentialsEndpoints();
|
|
2698
2704
|
}
|
|
2699
2705
|
get tokenResponse() {
|
|
2700
2706
|
return this._tokenResponse;
|