cidaas-javascript-sdk 3.0.3 → 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 -3
- package/README.md +7 -3
- package/package.json +1 -1
- package/src/main/authentication/index.ts +1 -1
- package/src/main/web-auth/Entities.ts +72 -72
- package/src/main/web-auth/LoginService.ts +5 -4
- package/src/main/web-auth/TokenService.ts +8 -2
- package/src/main/web-auth/UserService.ts +52 -8
- package/src/main/web-auth/WebAuth.ts +16 -33
- 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,7 +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
|
-
*
|
|
7
|
-
* update the type file ([df48bcf](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/df48bcf6a8436b9450a06f419c0a12e4345719ef))
|
|
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);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
resetRequestId: string
|
|
3
|
-
exchangeId: string
|
|
4
|
-
password: string
|
|
5
|
-
confirmPassword: string
|
|
6
|
-
provider
|
|
7
|
-
requestId
|
|
1
|
+
export interface AcceptResetPasswordEntity {
|
|
2
|
+
resetRequestId: string ;
|
|
3
|
+
exchangeId: string;
|
|
4
|
+
password: string;
|
|
5
|
+
confirmPassword: string;
|
|
6
|
+
provider?: string;
|
|
7
|
+
requestId?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export class AccessTokenRequest {
|
|
@@ -84,20 +84,20 @@ export interface IDeviceRequest {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export type AccountVerificationRequestEntity = {
|
|
87
|
-
email
|
|
88
|
-
mobile
|
|
89
|
-
phone
|
|
90
|
-
username
|
|
91
|
-
verificationMedium
|
|
92
|
-
processingType
|
|
93
|
-
requestId
|
|
94
|
-
client_id
|
|
95
|
-
redirect_uri
|
|
96
|
-
response_type
|
|
87
|
+
email?: string;
|
|
88
|
+
mobile?: string;
|
|
89
|
+
phone?: string;
|
|
90
|
+
username?: string;
|
|
91
|
+
verificationMedium?: string;
|
|
92
|
+
processingType?: string;
|
|
93
|
+
requestId?: string;
|
|
94
|
+
client_id?: string;
|
|
95
|
+
redirect_uri?: string;
|
|
96
|
+
response_type?: string;
|
|
97
97
|
sub: string;
|
|
98
|
-
templateKey
|
|
99
|
-
name
|
|
100
|
-
accept_language
|
|
98
|
+
templateKey?: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
accept_language?: string;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export interface ChangePasswordEntity {
|
|
@@ -403,31 +403,31 @@ export interface LoginFormRequestEntity {
|
|
|
403
403
|
username: string;
|
|
404
404
|
password: string;
|
|
405
405
|
requestId: string;
|
|
406
|
-
provider
|
|
407
|
-
captcha
|
|
408
|
-
username_type
|
|
409
|
-
field_key
|
|
410
|
-
bot_captcha_response
|
|
411
|
-
csrf_token
|
|
406
|
+
provider?: string;
|
|
407
|
+
captcha?: string;
|
|
408
|
+
username_type?: string;
|
|
409
|
+
field_key?: string;
|
|
410
|
+
bot_captcha_response?: string;
|
|
411
|
+
csrf_token?: string;
|
|
412
412
|
dc?: string;
|
|
413
413
|
device_fp?: string;
|
|
414
414
|
captcha_ref?: string;
|
|
415
415
|
locale?: string;
|
|
416
|
-
rememberMe
|
|
417
|
-
remember_me
|
|
416
|
+
rememberMe?: boolean;
|
|
417
|
+
remember_me?: boolean;
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
export interface ResetPasswordEntity {
|
|
421
421
|
email: string;
|
|
422
|
-
mobile
|
|
423
|
-
phone
|
|
424
|
-
username
|
|
425
|
-
resetMedium:
|
|
426
|
-
processingType:
|
|
422
|
+
mobile?: string;
|
|
423
|
+
phone?: string;
|
|
424
|
+
username?: string;
|
|
425
|
+
resetMedium: "SMS" | "EMAIL" | "IVR";
|
|
426
|
+
processingType: "CODE" | "LINK";
|
|
427
427
|
requestId: string;
|
|
428
|
-
provider
|
|
429
|
-
resetPasswordId
|
|
430
|
-
sub
|
|
428
|
+
provider?: string;
|
|
429
|
+
resetPasswordId?: string;
|
|
430
|
+
sub?: string;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
export class TokenIntrospectionEntity {
|
|
@@ -479,51 +479,51 @@ export interface UserActivityEntity {
|
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
export declare class UserEntity {
|
|
482
|
-
userStatus
|
|
482
|
+
userStatus?: string;
|
|
483
483
|
user_status?: string;
|
|
484
|
-
user_status_reason
|
|
485
|
-
username
|
|
486
|
-
sub
|
|
484
|
+
user_status_reason?: string;
|
|
485
|
+
username?: string;
|
|
486
|
+
sub?: string;
|
|
487
487
|
originalProviderUserId?: string[];
|
|
488
488
|
given_name: string;
|
|
489
489
|
family_name: string;
|
|
490
|
-
middle_name
|
|
491
|
-
nickname
|
|
490
|
+
middle_name?: string;
|
|
491
|
+
nickname?: string;
|
|
492
492
|
email: string;
|
|
493
|
-
email_verified
|
|
494
|
-
mobile_number
|
|
495
|
-
mobile_number_obj
|
|
496
|
-
mobile_number_verified
|
|
497
|
-
phone_number
|
|
498
|
-
phone_number_obj
|
|
499
|
-
phone_number_verified
|
|
500
|
-
profile
|
|
501
|
-
picture
|
|
502
|
-
website
|
|
503
|
-
gender
|
|
504
|
-
zoneinfo
|
|
505
|
-
locale
|
|
506
|
-
birthdate
|
|
493
|
+
email_verified?: boolean;
|
|
494
|
+
mobile_number?: string;
|
|
495
|
+
mobile_number_obj?: IMobileEntity | null;
|
|
496
|
+
mobile_number_verified?: boolean;
|
|
497
|
+
phone_number?: string;
|
|
498
|
+
phone_number_obj?: IMobileEntity | null;
|
|
499
|
+
phone_number_verified?: boolean;
|
|
500
|
+
profile?: string;
|
|
501
|
+
picture?: string;
|
|
502
|
+
website?: string;
|
|
503
|
+
gender?: string;
|
|
504
|
+
zoneinfo?: string;
|
|
505
|
+
locale?: string;
|
|
506
|
+
birthdate?: Date | string;
|
|
507
507
|
address?: AddressEntity;
|
|
508
508
|
customFields?: any;
|
|
509
509
|
identityCustomFields?: any;
|
|
510
510
|
password: string;
|
|
511
|
-
password_echo
|
|
512
|
-
password_hash_info
|
|
513
|
-
generate_password
|
|
514
|
-
provider
|
|
515
|
-
identityId
|
|
516
|
-
providerUserId
|
|
517
|
-
providerBusinessIds
|
|
518
|
-
street_address
|
|
511
|
+
password_echo: string;
|
|
512
|
+
password_hash_info?: any | null;
|
|
513
|
+
generate_password?: boolean;
|
|
514
|
+
provider?: string;
|
|
515
|
+
identityId?: string;
|
|
516
|
+
providerUserId?: string;
|
|
517
|
+
providerBusinessIds?: string[];
|
|
518
|
+
street_address?: string;
|
|
519
519
|
mfa_enabled?: boolean;
|
|
520
520
|
roles?: string[];
|
|
521
521
|
groups?: IUserGroupMap[];
|
|
522
522
|
userGroups?: IUserGroupMap[];
|
|
523
|
-
trackId
|
|
524
|
-
rawJSON
|
|
525
|
-
need_reset_password
|
|
526
|
-
no_event
|
|
523
|
+
trackId?: string;
|
|
524
|
+
rawJSON?: string;
|
|
525
|
+
need_reset_password?: boolean;
|
|
526
|
+
no_event?: boolean;
|
|
527
527
|
consents?: IConsentField[] | IConsentTrackingEntity[];
|
|
528
528
|
consent_track_ids?: string[];
|
|
529
529
|
ignore_default_roles?: string[];
|
|
@@ -634,12 +634,12 @@ export class ValidateResetPasswordEntity {
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
export interface IChangePasswordEntity {
|
|
637
|
-
sub
|
|
638
|
-
identityId
|
|
637
|
+
sub?: string;
|
|
638
|
+
identityId?: string;
|
|
639
639
|
old_password: string;
|
|
640
640
|
new_password: string;
|
|
641
641
|
confirm_password: string;
|
|
642
|
-
accessToken
|
|
642
|
+
accessToken?: string;
|
|
643
643
|
loginSettingsId: string;
|
|
644
|
-
client_id
|
|
644
|
+
client_id?: string;
|
|
645
645
|
}
|
|
@@ -69,7 +69,7 @@ export namespace LoginService {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* with social
|
|
73
73
|
* @param options
|
|
74
74
|
* @param queryParams
|
|
75
75
|
*/
|
|
@@ -231,10 +231,11 @@ export namespace LoginService {
|
|
|
231
231
|
* @param options
|
|
232
232
|
*/
|
|
233
233
|
export function loginAfterRegister(options: {
|
|
234
|
-
device_id
|
|
234
|
+
device_id?: string;
|
|
235
235
|
dc?: string;
|
|
236
|
-
rememberMe
|
|
237
|
-
trackId
|
|
236
|
+
rememberMe?: boolean;
|
|
237
|
+
trackId?: string;
|
|
238
|
+
device_fp?: string;
|
|
238
239
|
}) {
|
|
239
240
|
try {
|
|
240
241
|
const url = window.webAuthSettings.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
|
|
@@ -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
|
}
|
|
@@ -53,7 +53,7 @@ export namespace UserService {
|
|
|
53
53
|
captcha?: string;
|
|
54
54
|
acceptlanguage?: string;
|
|
55
55
|
bot_captcha_response?: string;
|
|
56
|
-
trackId
|
|
56
|
+
trackId?: string;
|
|
57
57
|
}) {
|
|
58
58
|
return new Promise((resolve, reject) => {
|
|
59
59
|
try {
|
|
@@ -178,9 +178,31 @@ export namespace UserService {
|
|
|
178
178
|
export function handleResetPassword(options: ValidateResetPasswordEntity) {
|
|
179
179
|
try {
|
|
180
180
|
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
182
|
+
let form = Helper.createForm(url, options)
|
|
183
|
+
document.body.appendChild(form);
|
|
184
|
+
form.submit();
|
|
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
|
+
} else {
|
|
194
|
+
resolve(false);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
http.open("POST", url, true);
|
|
199
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
200
|
+
http.send(JSON.stringify(options));
|
|
201
|
+
} catch (ex) {
|
|
202
|
+
reject(ex);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
184
206
|
} catch (ex) {
|
|
185
207
|
throw new CustomException(ex, 417);
|
|
186
208
|
}
|
|
@@ -191,11 +213,33 @@ export namespace UserService {
|
|
|
191
213
|
* @param options
|
|
192
214
|
*/
|
|
193
215
|
export function resetPassword(options: AcceptResetPasswordEntity) {
|
|
216
|
+
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
194
217
|
try {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
218
|
+
if (window.webAuthSettings.cidaas_version > 2) {
|
|
219
|
+
let form = Helper.createForm(url, options)
|
|
220
|
+
document.body.appendChild(form);
|
|
221
|
+
form.submit();
|
|
222
|
+
} else {
|
|
223
|
+
return new Promise(function (resolve, reject) {
|
|
224
|
+
try {
|
|
225
|
+
var http = new XMLHttpRequest();
|
|
226
|
+
http.onreadystatechange = function () {
|
|
227
|
+
if (http.readyState == 4) {
|
|
228
|
+
if (http.responseText) {
|
|
229
|
+
resolve(JSON.parse(http.responseText));
|
|
230
|
+
} else {
|
|
231
|
+
resolve(false);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
http.open("POST", url, true);
|
|
236
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
237
|
+
http.send(JSON.stringify(options));
|
|
238
|
+
} catch (ex) {
|
|
239
|
+
reject(ex);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
199
243
|
} catch (ex) {
|
|
200
244
|
throw new CustomException(ex, 417);
|
|
201
245
|
}
|
|
@@ -40,9 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export class WebAuth {
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
constructor(settings: UserManagerSettings & { mode?: string }) {
|
|
43
|
+
constructor(settings: UserManagerSettings & { mode?: string, cidaas_version: number }) {
|
|
46
44
|
try {
|
|
47
45
|
var usermanager = new UserManager(settings)
|
|
48
46
|
window.webAuthSettings = 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
|
|
|
@@ -733,7 +716,7 @@ export class WebAuth {
|
|
|
733
716
|
* @param headers
|
|
734
717
|
* @returns
|
|
735
718
|
*/
|
|
736
|
-
register(options: UserEntity, headers: { requestId: string; captcha?: string; acceptlanguage?: string; bot_captcha_response?: string; trackId
|
|
719
|
+
register(options: UserEntity, headers: { requestId: string; captcha?: string; acceptlanguage?: string; bot_captcha_response?: string; trackId?: string; }) {
|
|
737
720
|
return UserService.register(options, headers);
|
|
738
721
|
};
|
|
739
722
|
|
|
@@ -796,7 +779,7 @@ export class WebAuth {
|
|
|
796
779
|
* @param options
|
|
797
780
|
*/
|
|
798
781
|
handleResetPassword(options: ValidateResetPasswordEntity) {
|
|
799
|
-
UserService.handleResetPassword(options);
|
|
782
|
+
return UserService.handleResetPassword(options);
|
|
800
783
|
};
|
|
801
784
|
|
|
802
785
|
/**
|
|
@@ -804,7 +787,7 @@ export class WebAuth {
|
|
|
804
787
|
* @param options
|
|
805
788
|
*/
|
|
806
789
|
resetPassword(options: AcceptResetPasswordEntity) {
|
|
807
|
-
UserService.resetPassword(options);
|
|
790
|
+
return UserService.resetPassword(options);
|
|
808
791
|
};
|
|
809
792
|
|
|
810
793
|
/**
|
|
@@ -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
|
/**
|