cidaas-javascript-sdk 3.0.4 → 3.0.5
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/CHANGELOG.md +2 -2
- package/README.md +7 -3
- package/package.json +1 -1
- package/src/main/authentication/index.ts +1 -1
- package/src/main/web-auth/TokenService.ts +8 -2
- package/src/main/web-auth/WebAuth.ts +12 -29
- package/types/main/authentication/index.js +1 -1
- package/types/main/web-auth/Entities.d.ts +68 -68
- package/types/main/web-auth/Entities.js +1 -13
- package/types/main/web-auth/LoginService.d.ts +5 -4
- package/types/main/web-auth/LoginService.js +1 -1
- package/types/main/web-auth/TokenService.js +10 -3
- package/types/main/web-auth/UserService.d.ts +3 -3
- package/types/main/web-auth/UserService.js +58 -8
- package/types/main/web-auth/WebAuth.d.ts +4 -13
- package/types/main/web-auth/WebAuth.js +14 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [3.0.
|
|
1
|
+
## [3.0.5](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v3.0.4...v3.0.5) (2023-08-04)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* store code verifier in pkce flow ([f6f7835](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/f6f783507e6b3d7bc3bf24140e546951d71dd4b5))
|
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
## About cidaas:
|
|
2
4
|
[cidaas](https://www.cidaas.com)
|
|
3
5
|
is a fast and secure Cloud Identity & Access Management solution that standardises what’s important and simplifies what’s complex.
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
## Feature set includes:
|
|
5
8
|
* Single Sign On (SSO) based on OAuth 2.0, OpenID Connect, SAML 2.0
|
|
6
9
|
* Multi-Factor-Authentication with more than 14 authentication methods, including TOTP and FIDO2
|
|
7
10
|
* Passwordless Authentication
|
|
8
11
|
* Social Login (e.g. Facebook, Google, LinkedIn and more) as well as Enterprise Identity Provider (e.g. SAML or AD)
|
|
9
12
|
* Security in Machine-to-Machine (M2M) and IoT
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
# Cidaas Javascript SDK
|
|
15
|
+
|
|
12
16
|
This cidaas Javascript SDK library is built on the top of [OIDC client javascript library](https://github.com/IdentityModel/oidc-client-js).
|
|
13
17
|
|
|
14
18
|
#### Requirements
|
|
@@ -2578,4 +2582,4 @@ The SDK will throws Custom Exception if something went wrong during the operatio
|
|
|
2578
2582
|
| HTTP Status Code | When could it be thrown |
|
|
2579
2583
|
|----------------- | ----------------------- |
|
|
2580
2584
|
| 500 | during creation of WebAuth instance |
|
|
2581
|
-
| 417 | if there are any other failure |
|
|
2585
|
+
| 417 | if there are any other failure |
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@ export class Authentication {
|
|
|
44
44
|
return new Promise((resolve, reject) => {
|
|
45
45
|
try {
|
|
46
46
|
if (this.userManager) {
|
|
47
|
-
this.userManager.signinRedirectCallback(
|
|
47
|
+
this.userManager.signinRedirectCallback()
|
|
48
48
|
.then(function (user: any) {
|
|
49
49
|
if (user) {
|
|
50
50
|
resolve(user);
|
|
@@ -48,7 +48,6 @@ export namespace TokenService {
|
|
|
48
48
|
}
|
|
49
49
|
options.client_id = window.webAuthSettings.client_id;
|
|
50
50
|
options.redirect_uri = window.webAuthSettings.redirect_uri;
|
|
51
|
-
options.code_verifier = this.code_verifier;
|
|
52
51
|
options.grant_type = "authorization_code";
|
|
53
52
|
var http = new XMLHttpRequest();
|
|
54
53
|
var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
@@ -62,7 +61,14 @@ export namespace TokenService {
|
|
|
62
61
|
if (window.localeSettings) {
|
|
63
62
|
http.setRequestHeader("accept-language", window.localeSettings);
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
if (!window.webAuthSettings.disablePKCE) {
|
|
65
|
+
window.usermanager._client.createSigninRequest(window.webAuthSettings).then((signInRequest: any) => {
|
|
66
|
+
options.code_verifier = signInRequest.state?.code_verifier;
|
|
67
|
+
http.send(JSON.stringify(options));
|
|
68
|
+
})
|
|
69
|
+
} else {
|
|
70
|
+
http.send(JSON.stringify(options));
|
|
71
|
+
}
|
|
66
72
|
} catch (ex) {
|
|
67
73
|
reject(ex);
|
|
68
74
|
}
|
|
@@ -40,8 +40,6 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export class WebAuth {
|
|
42
42
|
|
|
43
|
-
private code_verifier: string;
|
|
44
|
-
|
|
45
43
|
constructor(settings: UserManagerSettings & { mode?: string, cidaas_version: number }) {
|
|
46
44
|
try {
|
|
47
45
|
var usermanager = new UserManager(settings)
|
|
@@ -60,21 +58,6 @@ export class WebAuth {
|
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
/**
|
|
64
|
-
* generate code verifier
|
|
65
|
-
*/
|
|
66
|
-
private generateCodeVerifier() {
|
|
67
|
-
this.code_verifier = crypto.randomUUID().replace(/-/g, "");
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param code_verifier
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
private generateCodeChallenge(code_verifier: string) {
|
|
75
|
-
return this.base64URL(CryptoJS.SHA256(code_verifier));
|
|
76
|
-
};
|
|
77
|
-
|
|
78
61
|
/**
|
|
79
62
|
* @param string
|
|
80
63
|
* @returns
|
|
@@ -249,19 +232,19 @@ export class WebAuth {
|
|
|
249
232
|
if (!settings.scope) {
|
|
250
233
|
settings.scope = "email openid profile mobile";
|
|
251
234
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
235
|
+
var loginURL = "";
|
|
236
|
+
window.usermanager._client.createSigninRequest(settings).then((signInRequest: any) => {
|
|
237
|
+
loginURL = signInRequest.url;
|
|
238
|
+
})
|
|
239
|
+
var timeRemaining = 5000
|
|
240
|
+
while(timeRemaining > 0) {
|
|
241
|
+
if (loginURL) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
setTimeout(() => {
|
|
245
|
+
timeRemaining -= 100
|
|
246
|
+
}, 100);
|
|
263
247
|
}
|
|
264
|
-
loginURL += "&scope=" + settings.scope;
|
|
265
248
|
return loginURL;
|
|
266
249
|
};
|
|
267
250
|
|
|
@@ -49,7 +49,7 @@ var Authentication = /** @class */ (function () {
|
|
|
49
49
|
return new Promise(function (resolve, reject) {
|
|
50
50
|
try {
|
|
51
51
|
if (_this.userManager) {
|
|
52
|
-
_this.userManager.signinRedirectCallback(
|
|
52
|
+
_this.userManager.signinRedirectCallback()
|
|
53
53
|
.then(function (user) {
|
|
54
54
|
if (user) {
|
|
55
55
|
resolve(user);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface AcceptResetPasswordEntity {
|
|
2
2
|
resetRequestId: string;
|
|
3
3
|
exchangeId: string;
|
|
4
4
|
password: string;
|
|
5
5
|
confirmPassword: string;
|
|
6
|
-
provider
|
|
7
|
-
requestId
|
|
6
|
+
provider?: string;
|
|
7
|
+
requestId?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare class AccessTokenRequest {
|
|
10
10
|
grant_type?: string;
|
|
@@ -71,20 +71,20 @@ export interface IDeviceRequest {
|
|
|
71
71
|
deviceType: string;
|
|
72
72
|
}
|
|
73
73
|
export type AccountVerificationRequestEntity = {
|
|
74
|
-
email
|
|
75
|
-
mobile
|
|
76
|
-
phone
|
|
77
|
-
username
|
|
78
|
-
verificationMedium
|
|
79
|
-
processingType
|
|
80
|
-
requestId
|
|
81
|
-
client_id
|
|
82
|
-
redirect_uri
|
|
83
|
-
response_type
|
|
74
|
+
email?: string;
|
|
75
|
+
mobile?: string;
|
|
76
|
+
phone?: string;
|
|
77
|
+
username?: string;
|
|
78
|
+
verificationMedium?: string;
|
|
79
|
+
processingType?: string;
|
|
80
|
+
requestId?: string;
|
|
81
|
+
client_id?: string;
|
|
82
|
+
redirect_uri?: string;
|
|
83
|
+
response_type?: string;
|
|
84
84
|
sub: string;
|
|
85
|
-
templateKey
|
|
86
|
-
name
|
|
87
|
-
accept_language
|
|
85
|
+
templateKey?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
accept_language?: string;
|
|
88
88
|
};
|
|
89
89
|
export interface ChangePasswordEntity {
|
|
90
90
|
sub: string;
|
|
@@ -346,30 +346,30 @@ export interface LoginFormRequestEntity {
|
|
|
346
346
|
username: string;
|
|
347
347
|
password: string;
|
|
348
348
|
requestId: string;
|
|
349
|
-
provider
|
|
350
|
-
captcha
|
|
351
|
-
username_type
|
|
352
|
-
field_key
|
|
353
|
-
bot_captcha_response
|
|
354
|
-
csrf_token
|
|
349
|
+
provider?: string;
|
|
350
|
+
captcha?: string;
|
|
351
|
+
username_type?: string;
|
|
352
|
+
field_key?: string;
|
|
353
|
+
bot_captcha_response?: string;
|
|
354
|
+
csrf_token?: string;
|
|
355
355
|
dc?: string;
|
|
356
356
|
device_fp?: string;
|
|
357
357
|
captcha_ref?: string;
|
|
358
358
|
locale?: string;
|
|
359
|
-
rememberMe
|
|
360
|
-
remember_me
|
|
359
|
+
rememberMe?: boolean;
|
|
360
|
+
remember_me?: boolean;
|
|
361
361
|
}
|
|
362
362
|
export interface ResetPasswordEntity {
|
|
363
363
|
email: string;
|
|
364
|
-
mobile
|
|
365
|
-
phone
|
|
366
|
-
username
|
|
367
|
-
resetMedium:
|
|
368
|
-
processingType:
|
|
364
|
+
mobile?: string;
|
|
365
|
+
phone?: string;
|
|
366
|
+
username?: string;
|
|
367
|
+
resetMedium: "SMS" | "EMAIL" | "IVR";
|
|
368
|
+
processingType: "CODE" | "LINK";
|
|
369
369
|
requestId: string;
|
|
370
|
-
provider
|
|
371
|
-
resetPasswordId
|
|
372
|
-
sub
|
|
370
|
+
provider?: string;
|
|
371
|
+
resetPasswordId?: string;
|
|
372
|
+
sub?: string;
|
|
373
373
|
}
|
|
374
374
|
export declare class TokenIntrospectionEntity {
|
|
375
375
|
token: string;
|
|
@@ -409,51 +409,51 @@ export interface UserActivityEntity {
|
|
|
409
409
|
events?: [string];
|
|
410
410
|
}
|
|
411
411
|
export declare class UserEntity {
|
|
412
|
-
userStatus
|
|
412
|
+
userStatus?: string;
|
|
413
413
|
user_status?: string;
|
|
414
|
-
user_status_reason
|
|
415
|
-
username
|
|
416
|
-
sub
|
|
414
|
+
user_status_reason?: string;
|
|
415
|
+
username?: string;
|
|
416
|
+
sub?: string;
|
|
417
417
|
originalProviderUserId?: string[];
|
|
418
418
|
given_name: string;
|
|
419
419
|
family_name: string;
|
|
420
|
-
middle_name
|
|
421
|
-
nickname
|
|
420
|
+
middle_name?: string;
|
|
421
|
+
nickname?: string;
|
|
422
422
|
email: string;
|
|
423
|
-
email_verified
|
|
424
|
-
mobile_number
|
|
425
|
-
mobile_number_obj
|
|
426
|
-
mobile_number_verified
|
|
427
|
-
phone_number
|
|
428
|
-
phone_number_obj
|
|
429
|
-
phone_number_verified
|
|
430
|
-
profile
|
|
431
|
-
picture
|
|
432
|
-
website
|
|
433
|
-
gender
|
|
434
|
-
zoneinfo
|
|
435
|
-
locale
|
|
436
|
-
birthdate
|
|
423
|
+
email_verified?: boolean;
|
|
424
|
+
mobile_number?: string;
|
|
425
|
+
mobile_number_obj?: IMobileEntity | null;
|
|
426
|
+
mobile_number_verified?: boolean;
|
|
427
|
+
phone_number?: string;
|
|
428
|
+
phone_number_obj?: IMobileEntity | null;
|
|
429
|
+
phone_number_verified?: boolean;
|
|
430
|
+
profile?: string;
|
|
431
|
+
picture?: string;
|
|
432
|
+
website?: string;
|
|
433
|
+
gender?: string;
|
|
434
|
+
zoneinfo?: string;
|
|
435
|
+
locale?: string;
|
|
436
|
+
birthdate?: Date | string;
|
|
437
437
|
address?: AddressEntity;
|
|
438
438
|
customFields?: any;
|
|
439
439
|
identityCustomFields?: any;
|
|
440
440
|
password: string;
|
|
441
|
-
password_echo
|
|
442
|
-
password_hash_info
|
|
443
|
-
generate_password
|
|
444
|
-
provider
|
|
445
|
-
identityId
|
|
446
|
-
providerUserId
|
|
447
|
-
providerBusinessIds
|
|
448
|
-
street_address
|
|
441
|
+
password_echo: string;
|
|
442
|
+
password_hash_info?: any | null;
|
|
443
|
+
generate_password?: boolean;
|
|
444
|
+
provider?: string;
|
|
445
|
+
identityId?: string;
|
|
446
|
+
providerUserId?: string;
|
|
447
|
+
providerBusinessIds?: string[];
|
|
448
|
+
street_address?: string;
|
|
449
449
|
mfa_enabled?: boolean;
|
|
450
450
|
roles?: string[];
|
|
451
451
|
groups?: IUserGroupMap[];
|
|
452
452
|
userGroups?: IUserGroupMap[];
|
|
453
|
-
trackId
|
|
454
|
-
rawJSON
|
|
455
|
-
need_reset_password
|
|
456
|
-
no_event
|
|
453
|
+
trackId?: string;
|
|
454
|
+
rawJSON?: string;
|
|
455
|
+
need_reset_password?: boolean;
|
|
456
|
+
no_event?: boolean;
|
|
457
457
|
consents?: IConsentField[] | IConsentTrackingEntity[];
|
|
458
458
|
consent_track_ids?: string[];
|
|
459
459
|
ignore_default_roles?: string[];
|
|
@@ -556,12 +556,12 @@ export declare class ValidateResetPasswordEntity {
|
|
|
556
556
|
code: string;
|
|
557
557
|
}
|
|
558
558
|
export interface IChangePasswordEntity {
|
|
559
|
-
sub
|
|
560
|
-
identityId
|
|
559
|
+
sub?: string;
|
|
560
|
+
identityId?: string;
|
|
561
561
|
old_password: string;
|
|
562
562
|
new_password: string;
|
|
563
563
|
confirm_password: string;
|
|
564
|
-
accessToken
|
|
564
|
+
accessToken?: string;
|
|
565
565
|
loginSettingsId: string;
|
|
566
|
-
client_id
|
|
566
|
+
client_id?: string;
|
|
567
567
|
}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.ValidateResetPasswordEntity = exports.UpdateReviewDeviceEntity = exports.GroupValidationEntity = exports.TokenIntrospectionEntity = exports.FindUserEntity = exports.PhysicalVerificationLoginRequest = exports.AccessTokenRequest =
|
|
4
|
-
var AcceptResetPasswordEntity = /** @class */ (function () {
|
|
5
|
-
function AcceptResetPasswordEntity() {
|
|
6
|
-
this.resetRequestId = "";
|
|
7
|
-
this.exchangeId = "";
|
|
8
|
-
this.password = "";
|
|
9
|
-
this.confirmPassword = "";
|
|
10
|
-
this.provider = "";
|
|
11
|
-
this.requestId = "";
|
|
12
|
-
}
|
|
13
|
-
return AcceptResetPasswordEntity;
|
|
14
|
-
}());
|
|
15
|
-
exports.AcceptResetPasswordEntity = AcceptResetPasswordEntity;
|
|
3
|
+
exports.ValidateResetPasswordEntity = exports.UpdateReviewDeviceEntity = exports.GroupValidationEntity = exports.TokenIntrospectionEntity = exports.FindUserEntity = exports.PhysicalVerificationLoginRequest = exports.AccessTokenRequest = void 0;
|
|
16
4
|
var AccessTokenRequest = /** @class */ (function () {
|
|
17
5
|
function AccessTokenRequest() {
|
|
18
6
|
this.user_agent = "";
|
|
@@ -24,7 +24,7 @@ export declare namespace LoginService {
|
|
|
24
24
|
device_fp: string;
|
|
25
25
|
}): void;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* with social
|
|
28
28
|
* @param options
|
|
29
29
|
* @param queryParams
|
|
30
30
|
*/
|
|
@@ -94,9 +94,10 @@ export declare namespace LoginService {
|
|
|
94
94
|
* @param options
|
|
95
95
|
*/
|
|
96
96
|
function loginAfterRegister(options: {
|
|
97
|
-
device_id
|
|
97
|
+
device_id?: string;
|
|
98
98
|
dc?: string;
|
|
99
|
-
rememberMe
|
|
100
|
-
trackId
|
|
99
|
+
rememberMe?: boolean;
|
|
100
|
+
trackId?: string;
|
|
101
|
+
device_fp?: string;
|
|
101
102
|
}): void;
|
|
102
103
|
}
|
|
@@ -44,7 +44,6 @@ var TokenService;
|
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
46
|
function getAccessToken(options) {
|
|
47
|
-
var _this = this;
|
|
48
47
|
return new Promise(function (resolve, reject) {
|
|
49
48
|
try {
|
|
50
49
|
if (!options.code) {
|
|
@@ -52,7 +51,6 @@ var TokenService;
|
|
|
52
51
|
}
|
|
53
52
|
options.client_id = window.webAuthSettings.client_id;
|
|
54
53
|
options.redirect_uri = window.webAuthSettings.redirect_uri;
|
|
55
|
-
options.code_verifier = _this.code_verifier;
|
|
56
54
|
options.grant_type = "authorization_code";
|
|
57
55
|
var http = new XMLHttpRequest();
|
|
58
56
|
var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
@@ -66,7 +64,16 @@ var TokenService;
|
|
|
66
64
|
if (window.localeSettings) {
|
|
67
65
|
http.setRequestHeader("accept-language", window.localeSettings);
|
|
68
66
|
}
|
|
69
|
-
|
|
67
|
+
if (!window.webAuthSettings.disablePKCE) {
|
|
68
|
+
window.usermanager._client.createSigninRequest(window.webAuthSettings).then(function (signInRequest) {
|
|
69
|
+
var _a;
|
|
70
|
+
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
71
|
+
http.send(JSON.stringify(options));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
http.send(JSON.stringify(options));
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
78
|
catch (ex) {
|
|
72
79
|
reject(ex);
|
|
@@ -19,7 +19,7 @@ export declare namespace UserService {
|
|
|
19
19
|
captcha?: string;
|
|
20
20
|
acceptlanguage?: string;
|
|
21
21
|
bot_captcha_response?: string;
|
|
22
|
-
trackId
|
|
22
|
+
trackId?: string;
|
|
23
23
|
}): Promise<unknown>;
|
|
24
24
|
/**
|
|
25
25
|
* get invite info
|
|
@@ -48,12 +48,12 @@ export declare namespace UserService {
|
|
|
48
48
|
* handle reset password
|
|
49
49
|
* @param options
|
|
50
50
|
*/
|
|
51
|
-
function handleResetPassword(options: ValidateResetPasswordEntity):
|
|
51
|
+
function handleResetPassword(options: ValidateResetPasswordEntity): Promise<unknown>;
|
|
52
52
|
/**
|
|
53
53
|
* reset password
|
|
54
54
|
* @param options
|
|
55
55
|
*/
|
|
56
|
-
function resetPassword(options: AcceptResetPasswordEntity):
|
|
56
|
+
function resetPassword(options: AcceptResetPasswordEntity): Promise<unknown>;
|
|
57
57
|
/**
|
|
58
58
|
* get Deduplication details
|
|
59
59
|
* @param options
|
|
@@ -176,10 +176,35 @@ var UserService;
|
|
|
176
176
|
*/
|
|
177
177
|
function handleResetPassword(options) {
|
|
178
178
|
try {
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
var url_1 = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
180
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
181
|
+
var form = Helper_1.Helper.createForm(url_1, options);
|
|
182
|
+
document.body.appendChild(form);
|
|
183
|
+
form.submit();
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
return new Promise(function (resolve, reject) {
|
|
187
|
+
try {
|
|
188
|
+
var http = new XMLHttpRequest();
|
|
189
|
+
http.onreadystatechange = function () {
|
|
190
|
+
if (http.readyState == 4) {
|
|
191
|
+
if (http.responseText) {
|
|
192
|
+
resolve(JSON.parse(http.responseText));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
resolve(false);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
http.open("POST", url_1, true);
|
|
200
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
201
|
+
http.send(JSON.stringify(options));
|
|
202
|
+
}
|
|
203
|
+
catch (ex) {
|
|
204
|
+
reject(ex);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
183
208
|
}
|
|
184
209
|
catch (ex) {
|
|
185
210
|
throw new Helper_1.CustomException(ex, 417);
|
|
@@ -192,11 +217,36 @@ var UserService;
|
|
|
192
217
|
* @param options
|
|
193
218
|
*/
|
|
194
219
|
function resetPassword(options) {
|
|
220
|
+
var url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
195
221
|
try {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
222
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
223
|
+
var form = Helper_1.Helper.createForm(url, options);
|
|
224
|
+
document.body.appendChild(form);
|
|
225
|
+
form.submit();
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return new Promise(function (resolve, reject) {
|
|
229
|
+
try {
|
|
230
|
+
var http = new XMLHttpRequest();
|
|
231
|
+
http.onreadystatechange = function () {
|
|
232
|
+
if (http.readyState == 4) {
|
|
233
|
+
if (http.responseText) {
|
|
234
|
+
resolve(JSON.parse(http.responseText));
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
resolve(false);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
http.open("POST", url, true);
|
|
242
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
243
|
+
http.send(JSON.stringify(options));
|
|
244
|
+
}
|
|
245
|
+
catch (ex) {
|
|
246
|
+
reject(ex);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
200
250
|
}
|
|
201
251
|
catch (ex) {
|
|
202
252
|
throw new Helper_1.CustomException(ex, 417);
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { UserManagerSettings } from "oidc-client-ts";
|
|
2
2
|
import { AccessTokenRequest, TokenIntrospectionEntity, UserEntity, ResetPasswordEntity, IConfiguredListRequestEntity, IInitVerificationAuthenticationRequestEntity, FindUserEntity, IUserEntity, FidoSetupEntity, IEnrollVerificationSetupRequestEntity, ISuggestedMFAActionConfig, IUserLinkEntity, UpdateReviewDeviceEntity, UserActivityEntity, ChangePasswordEntity, IConsentAcceptEntity, IAuthVerificationAuthenticationRequestEntity, FaceVerificationAuthenticationRequestEntity, LoginFormRequestEntity, AccountVerificationRequestEntity, ValidateResetPasswordEntity, AcceptResetPasswordEntity, LoginFormRequestAsyncEntity, PhysicalVerificationLoginRequest, IChangePasswordEntity } from "./Entities";
|
|
3
3
|
export declare class WebAuth {
|
|
4
|
-
private code_verifier;
|
|
5
4
|
constructor(settings: UserManagerSettings & {
|
|
6
5
|
mode?: string;
|
|
6
|
+
cidaas_version: number;
|
|
7
7
|
});
|
|
8
|
-
/**
|
|
9
|
-
* generate code verifier
|
|
10
|
-
*/
|
|
11
|
-
private generateCodeVerifier;
|
|
12
|
-
/**
|
|
13
|
-
* @param code_verifier
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
private generateCodeChallenge;
|
|
17
8
|
/**
|
|
18
9
|
* @param string
|
|
19
10
|
* @returns
|
|
@@ -208,7 +199,7 @@ export declare class WebAuth {
|
|
|
208
199
|
captcha?: string;
|
|
209
200
|
acceptlanguage?: string;
|
|
210
201
|
bot_captcha_response?: string;
|
|
211
|
-
trackId
|
|
202
|
+
trackId?: string;
|
|
212
203
|
}): Promise<unknown>;
|
|
213
204
|
/**
|
|
214
205
|
* get invite info
|
|
@@ -258,12 +249,12 @@ export declare class WebAuth {
|
|
|
258
249
|
* handle reset password
|
|
259
250
|
* @param options
|
|
260
251
|
*/
|
|
261
|
-
handleResetPassword(options: ValidateResetPasswordEntity):
|
|
252
|
+
handleResetPassword(options: ValidateResetPasswordEntity): Promise<unknown>;
|
|
262
253
|
/**
|
|
263
254
|
* reset password
|
|
264
255
|
* @param options
|
|
265
256
|
*/
|
|
266
|
-
resetPassword(options: AcceptResetPasswordEntity):
|
|
257
|
+
resetPassword(options: AcceptResetPasswordEntity): Promise<unknown>;
|
|
267
258
|
/**
|
|
268
259
|
* get mfa list v2
|
|
269
260
|
* @param options
|
|
@@ -66,21 +66,6 @@ var WebAuth = /** @class */ (function () {
|
|
|
66
66
|
console.log(ex);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
70
|
-
* generate code verifier
|
|
71
|
-
*/
|
|
72
|
-
WebAuth.prototype.generateCodeVerifier = function () {
|
|
73
|
-
this.code_verifier = crypto.randomUUID().replace(/-/g, "");
|
|
74
|
-
};
|
|
75
|
-
;
|
|
76
|
-
/**
|
|
77
|
-
* @param code_verifier
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
WebAuth.prototype.generateCodeChallenge = function (code_verifier) {
|
|
81
|
-
return this.base64URL(CryptoJS.SHA256(code_verifier));
|
|
82
|
-
};
|
|
83
|
-
;
|
|
84
69
|
/**
|
|
85
70
|
* @param string
|
|
86
71
|
* @returns
|
|
@@ -273,17 +258,19 @@ var WebAuth = /** @class */ (function () {
|
|
|
273
258
|
if (!settings.scope) {
|
|
274
259
|
settings.scope = "email openid profile mobile";
|
|
275
260
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
261
|
+
var loginURL = "";
|
|
262
|
+
window.usermanager._client.createSigninRequest(settings).then(function (signInRequest) {
|
|
263
|
+
loginURL = signInRequest.url;
|
|
264
|
+
});
|
|
265
|
+
var timeRemaining = 5000;
|
|
266
|
+
while (timeRemaining > 0) {
|
|
267
|
+
if (loginURL) {
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
setTimeout(function () {
|
|
271
|
+
timeRemaining -= 100;
|
|
272
|
+
}, 100);
|
|
285
273
|
}
|
|
286
|
-
loginURL += "&scope=" + settings.scope;
|
|
287
274
|
return loginURL;
|
|
288
275
|
};
|
|
289
276
|
;
|
|
@@ -867,7 +854,7 @@ var WebAuth = /** @class */ (function () {
|
|
|
867
854
|
* @param options
|
|
868
855
|
*/
|
|
869
856
|
WebAuth.prototype.handleResetPassword = function (options) {
|
|
870
|
-
UserService_1.UserService.handleResetPassword(options);
|
|
857
|
+
return UserService_1.UserService.handleResetPassword(options);
|
|
871
858
|
};
|
|
872
859
|
;
|
|
873
860
|
/**
|
|
@@ -875,7 +862,7 @@ var WebAuth = /** @class */ (function () {
|
|
|
875
862
|
* @param options
|
|
876
863
|
*/
|
|
877
864
|
WebAuth.prototype.resetPassword = function (options) {
|
|
878
|
-
UserService_1.UserService.resetPassword(options);
|
|
865
|
+
return UserService_1.UserService.resetPassword(options);
|
|
879
866
|
};
|
|
880
867
|
;
|
|
881
868
|
/**
|