cidaas-javascript-sdk 4.2.3 → 4.3.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/CHANGELOG.md +23 -3
- package/README.md +3 -0
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +21 -10
- package/dist/authentication/Authentication.model.js +23 -0
- package/dist/common/Common.model.d.ts +37 -0
- package/dist/common/Common.model.js +26 -0
- package/dist/{web-auth → common}/Helper.d.ts +6 -6
- package/dist/{web-auth → common}/Helper.js +17 -12
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +13 -9
- package/dist/common/User.model.d.ts +134 -0
- package/dist/common/User.model.js +2 -0
- package/dist/consent-service/ConsentService.d.ts +96 -0
- package/dist/consent-service/ConsentService.js +127 -0
- package/dist/consent-service/ConsentService.model.d.ts +102 -0
- package/dist/consent-service/ConsentService.model.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/login-service/LoginService.d.ts +143 -0
- package/dist/login-service/LoginService.js +247 -0
- package/dist/login-service/LoginService.model.d.ts +138 -0
- package/dist/login-service/LoginService.model.js +13 -0
- package/dist/token-service/TokenService.d.ts +139 -0
- package/dist/token-service/TokenService.js +242 -0
- package/dist/token-service/TokenService.model.d.ts +149 -0
- package/dist/token-service/TokenService.model.js +43 -0
- package/dist/user-service/UserService.d.ts +317 -0
- package/dist/user-service/UserService.js +451 -0
- package/dist/user-service/UserService.model.d.ts +142 -0
- package/dist/user-service/UserService.model.js +10 -0
- package/dist/verification-service/VerificationService.d.ts +218 -0
- package/dist/verification-service/VerificationService.js +288 -0
- package/dist/verification-service/VerificationService.model.d.ts +158 -0
- package/dist/verification-service/VerificationService.model.js +2 -0
- package/dist/web-auth/WebAuth.d.ts +110 -177
- package/dist/web-auth/WebAuth.js +98 -123
- package/dist/web-auth/webauth.model.d.ts +50 -0
- package/dist/web-auth/webauth.model.js +2 -0
- package/package.json +1 -1
- package/dist/authentication/authentication.model.js +0 -18
- package/dist/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -133
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -59
- package/dist/web-auth/JwtHelper.d.ts +0 -7
- package/dist/web-auth/LoginService.d.ts +0 -165
- package/dist/web-auth/LoginService.js +0 -243
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -246
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -468
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -275
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
package/dist/web-auth/WebAuth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -7,17 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebAuth = exports.createPreloginWebauth = void 0;
|
|
13
|
+
const Helper_1 = require("../common/Helper");
|
|
14
|
+
const LoginService = require("../login-service/LoginService");
|
|
15
|
+
const UserService = require("../user-service/UserService");
|
|
16
|
+
const TokenService = require("../token-service/TokenService");
|
|
17
|
+
const VerificationService = require("../verification-service/VerificationService");
|
|
18
|
+
const ConsentService = require("../consent-service/ConsentService");
|
|
19
|
+
const Authentication_1 = require("../authentication/Authentication");
|
|
20
|
+
const Authentication_model_1 = require("../authentication/Authentication.model");
|
|
21
|
+
const createPreloginWebauth = (authority) => {
|
|
18
22
|
return new WebAuth({ 'authority': authority });
|
|
19
23
|
};
|
|
20
|
-
|
|
24
|
+
exports.createPreloginWebauth = createPreloginWebauth;
|
|
25
|
+
class WebAuth {
|
|
21
26
|
constructor(settings) {
|
|
22
27
|
try {
|
|
23
28
|
if (!settings.response_type) {
|
|
@@ -29,13 +34,13 @@ export class WebAuth {
|
|
|
29
34
|
if (settings.authority && settings.authority.charAt(settings.authority.length - 1) === '/') {
|
|
30
35
|
settings.authority = settings.authority.slice(0, settings.authority.length - 1);
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
const usermanager = new Authentication_model_1.OidcManager(settings);
|
|
33
38
|
window.webAuthSettings = settings;
|
|
34
39
|
window.usermanager = usermanager;
|
|
35
40
|
window.localeSettings = null;
|
|
36
|
-
window.authentication = new Authentication(window.webAuthSettings, window.usermanager);
|
|
41
|
+
window.authentication = new Authentication_1.Authentication(window.webAuthSettings, window.usermanager);
|
|
37
42
|
window.usermanager.events.addSilentRenewError(function () {
|
|
38
|
-
throw new CustomException("Error while renewing silent login", 500);
|
|
43
|
+
throw new Helper_1.CustomException("Error while renewing silent login", 500);
|
|
39
44
|
});
|
|
40
45
|
}
|
|
41
46
|
catch (ex) {
|
|
@@ -49,11 +54,10 @@ export class WebAuth {
|
|
|
49
54
|
*/
|
|
50
55
|
loginWithBrowser(options) {
|
|
51
56
|
if (!window.webAuthSettings || !window.authentication) {
|
|
52
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
57
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
53
58
|
}
|
|
54
59
|
return window.authentication.loginOrRegisterWithBrowser('login', options);
|
|
55
60
|
}
|
|
56
|
-
;
|
|
57
61
|
/**
|
|
58
62
|
* Generate and open authz url in a popup window.
|
|
59
63
|
* On successful sign in, authenticated user is returned.
|
|
@@ -64,11 +68,10 @@ export class WebAuth {
|
|
|
64
68
|
*/
|
|
65
69
|
popupSignIn(options) {
|
|
66
70
|
if (!window.webAuthSettings || !window.authentication) {
|
|
67
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
71
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
68
72
|
}
|
|
69
73
|
return window.authentication.popupSignIn(options);
|
|
70
74
|
}
|
|
71
|
-
;
|
|
72
75
|
/**
|
|
73
76
|
* Generate and navigate to authz url in an iFrame.
|
|
74
77
|
* On successful sign in, authenticated user is returned
|
|
@@ -79,22 +82,20 @@ export class WebAuth {
|
|
|
79
82
|
*/
|
|
80
83
|
silentSignIn(options) {
|
|
81
84
|
if (!window.webAuthSettings || !window.authentication) {
|
|
82
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
85
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
83
86
|
}
|
|
84
87
|
return window.authentication.silentSignIn(options);
|
|
85
88
|
}
|
|
86
|
-
;
|
|
87
89
|
/**
|
|
88
90
|
* Generate and redirect to authz url in same window for register view.
|
|
89
91
|
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
90
92
|
*/
|
|
91
93
|
registerWithBrowser(options) {
|
|
92
94
|
if (!window.webAuthSettings || !window.authentication) {
|
|
93
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
95
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
94
96
|
}
|
|
95
97
|
return window.authentication.loginOrRegisterWithBrowser('register', options);
|
|
96
98
|
}
|
|
97
|
-
;
|
|
98
99
|
/**
|
|
99
100
|
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
100
101
|
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
@@ -105,11 +106,10 @@ export class WebAuth {
|
|
|
105
106
|
*/
|
|
106
107
|
loginCallback(url) {
|
|
107
108
|
if (!window.webAuthSettings || !window.authentication) {
|
|
108
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
109
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
109
110
|
}
|
|
110
111
|
return window.authentication.loginCallback(url);
|
|
111
112
|
}
|
|
112
|
-
;
|
|
113
113
|
/**
|
|
114
114
|
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
115
115
|
* Popup window will be closed after doing callback
|
|
@@ -119,22 +119,20 @@ export class WebAuth {
|
|
|
119
119
|
*/
|
|
120
120
|
popupSignInCallback(url, keepOpen) {
|
|
121
121
|
if (!window.webAuthSettings || !window.authentication) {
|
|
122
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
122
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
123
123
|
}
|
|
124
124
|
return window.authentication.popupSignInCallback(url, keepOpen);
|
|
125
125
|
}
|
|
126
|
-
;
|
|
127
126
|
/**
|
|
128
127
|
* Returns a promise to notify the parent window of response from authz service
|
|
129
128
|
* @param {string} url optional url to check authz response, if none window.location is used
|
|
130
129
|
*/
|
|
131
130
|
silentSignInCallback(url) {
|
|
132
131
|
if (!window.webAuthSettings || !window.authentication) {
|
|
133
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
132
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
134
133
|
}
|
|
135
134
|
return window.authentication.silentSignInCallback(url);
|
|
136
135
|
}
|
|
137
|
-
;
|
|
138
136
|
/**
|
|
139
137
|
* To get the user profile information by using oidc-client-ts library, call **getUserInfo()**. This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
|
|
140
138
|
* @example
|
|
@@ -150,45 +148,41 @@ export class WebAuth {
|
|
|
150
148
|
getUserInfo() {
|
|
151
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
150
|
if (!window.usermanager) {
|
|
153
|
-
return Promise.reject(new CustomException("UserManager cannot be empty", 417));
|
|
151
|
+
return Promise.reject(new Helper_1.CustomException("UserManager cannot be empty", 417));
|
|
154
152
|
}
|
|
155
153
|
return yield window.usermanager.getUser();
|
|
156
154
|
});
|
|
157
155
|
}
|
|
158
|
-
;
|
|
159
156
|
/**
|
|
160
157
|
* logout by using oidc-client-ts library
|
|
161
158
|
* @param {LogoutRedirectOptions} options optional options to over-ride logout options on redirect
|
|
162
159
|
*/
|
|
163
160
|
logout(options) {
|
|
164
161
|
if (!window.webAuthSettings || !window.authentication) {
|
|
165
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
162
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
166
163
|
}
|
|
167
164
|
return window.authentication.logout(options);
|
|
168
165
|
}
|
|
169
|
-
;
|
|
170
166
|
/**
|
|
171
167
|
* logout by using oidc-client-ts library
|
|
172
168
|
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
173
169
|
*/
|
|
174
170
|
popupSignOut(options) {
|
|
175
171
|
if (!window.webAuthSettings || !window.authentication) {
|
|
176
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
172
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
177
173
|
}
|
|
178
174
|
return window.authentication.popupSignOut(options);
|
|
179
175
|
}
|
|
180
|
-
;
|
|
181
176
|
/**
|
|
182
177
|
* get the logout call state from the url provided, if none is provided current window url is used
|
|
183
178
|
* @returns {Promise<LogoutResponse>} logout response from auth service
|
|
184
179
|
*/
|
|
185
180
|
logoutCallback(url) {
|
|
186
181
|
if (!window.webAuthSettings || !window.authentication) {
|
|
187
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
182
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
188
183
|
}
|
|
189
184
|
return window.authentication.logoutCallback(url);
|
|
190
185
|
}
|
|
191
|
-
;
|
|
192
186
|
/**
|
|
193
187
|
* listen to popup sign out event
|
|
194
188
|
* @param {string} url optional url to override to check for sign out state
|
|
@@ -196,12 +190,11 @@ export class WebAuth {
|
|
|
196
190
|
*/
|
|
197
191
|
popupSignOutCallback(url, keepOpen) {
|
|
198
192
|
if (!window.webAuthSettings || !window.authentication) {
|
|
199
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
193
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
200
194
|
}
|
|
201
195
|
url = url || window.webAuthSettings.post_logout_redirect_uri;
|
|
202
196
|
return window.authentication.popupSignOutCallback(url, keepOpen);
|
|
203
197
|
}
|
|
204
|
-
;
|
|
205
198
|
/**
|
|
206
199
|
* To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
|
|
207
200
|
* @example
|
|
@@ -217,20 +210,16 @@ export class WebAuth {
|
|
|
217
210
|
*/
|
|
218
211
|
getLoginURL(options) {
|
|
219
212
|
if (!window.webAuthSettings || !window.authentication) {
|
|
220
|
-
return Promise.reject(new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
213
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
221
214
|
}
|
|
222
215
|
return new Promise((resolve, reject) => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
catch (e) {
|
|
216
|
+
window.usermanager.getClient().createSigninRequest(Object.assign(Object.assign({}, window.webAuthSettings), (options && { options } || {}))).then((signinRequest) => {
|
|
217
|
+
resolve(signinRequest.url);
|
|
218
|
+
}).catch(e => {
|
|
229
219
|
reject(e);
|
|
230
|
-
}
|
|
220
|
+
});
|
|
231
221
|
});
|
|
232
222
|
}
|
|
233
|
-
;
|
|
234
223
|
/**
|
|
235
224
|
* Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call **getRequestId()**.
|
|
236
225
|
* @example
|
|
@@ -247,9 +236,8 @@ export class WebAuth {
|
|
|
247
236
|
const ui_locales = window.webAuthSettings.ui_locales;
|
|
248
237
|
const options = Object.assign({ 'client_id': window.webAuthSettings.client_id, 'redirect_uri': window.webAuthSettings.redirect_uri, 'response_type': (_a = window.webAuthSettings.response_type) !== null && _a !== void 0 ? _a : 'token', "response_mode": (_b = window.webAuthSettings.response_mode) !== null && _b !== void 0 ? _b : 'fragment', "scope": window.webAuthSettings.scope, "nonce": new Date().getTime().toString() }, (ui_locales && { ui_locales } || {}));
|
|
249
238
|
const serviceURL = window.webAuthSettings.authority + '/authz-srv/authrequest/authz/generate';
|
|
250
|
-
return Helper.createHttpPromise(options, serviceURL, false, "POST");
|
|
239
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, "POST");
|
|
251
240
|
}
|
|
252
|
-
;
|
|
253
241
|
/**
|
|
254
242
|
* To get the tenant basic information, call **getTenantInfo()**. This will return the basic tenant details such as tenant name and allowed login with types (Email, Mobile, Username).
|
|
255
243
|
* @example
|
|
@@ -263,9 +251,8 @@ export class WebAuth {
|
|
|
263
251
|
*/
|
|
264
252
|
getTenantInfo() {
|
|
265
253
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/tenantinfo/basic";
|
|
266
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
254
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
267
255
|
}
|
|
268
|
-
;
|
|
269
256
|
/**
|
|
270
257
|
* To logout the user by using cidaas internal api, call **logoutUser()**.
|
|
271
258
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3b5ce6a54bf29-logout for more details.
|
|
@@ -279,7 +266,6 @@ export class WebAuth {
|
|
|
279
266
|
logoutUser(options) {
|
|
280
267
|
window.location.href = window.webAuthSettings.authority + "/session/end_session?access_token_hint=" + options.access_token + "&post_logout_redirect_uri=" + window.webAuthSettings.post_logout_redirect_uri;
|
|
281
268
|
}
|
|
282
|
-
;
|
|
283
269
|
/**
|
|
284
270
|
* To get the client basic information, call **getClientInfo()**. This will return the basic client details such as client name and its details.
|
|
285
271
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/dc8a6cfb28abb-public-page-information for more details.
|
|
@@ -296,15 +282,14 @@ export class WebAuth {
|
|
|
296
282
|
*/
|
|
297
283
|
getClientInfo(options) {
|
|
298
284
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/" + options.requestId;
|
|
299
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
285
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
300
286
|
}
|
|
301
|
-
;
|
|
302
287
|
/**
|
|
303
288
|
* To get all devices information associated to the client, call **getDevicesInfo()**
|
|
304
289
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a2feed70303c-get-device-by-user for more details.
|
|
305
290
|
* @example
|
|
306
291
|
* ```js
|
|
307
|
-
* const options =
|
|
292
|
+
* const options = null; // the payload is deprecated and will be removed in the next major release
|
|
308
293
|
* const accessToken = 'your access token';
|
|
309
294
|
* cidaas.getDevicesInfo(options, accessToken).then(function (resp) {
|
|
310
295
|
* // the response will give you devices informations.
|
|
@@ -314,14 +299,10 @@ export class WebAuth {
|
|
|
314
299
|
* ```
|
|
315
300
|
*/
|
|
316
301
|
getDevicesInfo(options, accessToken) {
|
|
317
|
-
options
|
|
302
|
+
options = undefined;
|
|
318
303
|
const _serviceURL = window.webAuthSettings.authority + "/device-srv/devices";
|
|
319
|
-
|
|
320
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "GET", accessToken);
|
|
321
|
-
}
|
|
322
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET", accessToken);
|
|
304
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "GET", accessToken);
|
|
323
305
|
}
|
|
324
|
-
;
|
|
325
306
|
/**
|
|
326
307
|
* To delete device associated to the client, call **deleteDevice()**
|
|
327
308
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3d44ad903d6e8-logout-the-user-for-a-device for more details.
|
|
@@ -342,11 +323,10 @@ export class WebAuth {
|
|
|
342
323
|
const _serviceURL = window.webAuthSettings.authority + "/device-srv/device/" + options.device_id;
|
|
343
324
|
options.userAgent = window.navigator.userAgent;
|
|
344
325
|
if (window.navigator.userAgent) {
|
|
345
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "DELETE", accessToken);
|
|
326
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "DELETE", accessToken);
|
|
346
327
|
}
|
|
347
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "DELETE", accessToken);
|
|
328
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "DELETE", accessToken);
|
|
348
329
|
}
|
|
349
|
-
;
|
|
350
330
|
/**
|
|
351
331
|
* To handle registration, first you need the registration fields. To get the registration fields, call **getRegistrationSetup()**. This will return the fields that has to be needed while registration.
|
|
352
332
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4eae72956f65a-registration-field-setup for more details.
|
|
@@ -364,9 +344,8 @@ export class WebAuth {
|
|
|
364
344
|
*/
|
|
365
345
|
getRegistrationSetup(options) {
|
|
366
346
|
const serviceURL = window.webAuthSettings.authority + '/registration-setup-srv/public/list?acceptlanguage=' + options.acceptlanguage + '&requestId=' + options.requestId;
|
|
367
|
-
return Helper.createHttpPromise(undefined, serviceURL, false, 'GET');
|
|
347
|
+
return Helper_1.Helper.createHttpPromise(undefined, serviceURL, false, 'GET');
|
|
368
348
|
}
|
|
369
|
-
;
|
|
370
349
|
/**
|
|
371
350
|
* to generate device info, call **createDeviceInfo()**.
|
|
372
351
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9b5a892afaf0b-create-device-info for more details.
|
|
@@ -386,10 +365,9 @@ export class WebAuth {
|
|
|
386
365
|
userAgent: window.navigator.userAgent
|
|
387
366
|
};
|
|
388
367
|
const serviceURL = window.webAuthSettings.authority + '/device-srv/deviceinfo';
|
|
389
|
-
return Helper.createHttpPromise(options, serviceURL, false, 'POST');
|
|
368
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST');
|
|
390
369
|
}
|
|
391
370
|
}
|
|
392
|
-
;
|
|
393
371
|
/**
|
|
394
372
|
* get the user profile information
|
|
395
373
|
* @param options
|
|
@@ -398,7 +376,6 @@ export class WebAuth {
|
|
|
398
376
|
getUserProfile(options) {
|
|
399
377
|
return UserService.getUserProfile(options);
|
|
400
378
|
}
|
|
401
|
-
;
|
|
402
379
|
/**
|
|
403
380
|
* renew token using refresh token
|
|
404
381
|
* @param options
|
|
@@ -407,7 +384,6 @@ export class WebAuth {
|
|
|
407
384
|
renewToken(options) {
|
|
408
385
|
return TokenService.renewToken(options);
|
|
409
386
|
}
|
|
410
|
-
;
|
|
411
387
|
/**
|
|
412
388
|
* get access token from code
|
|
413
389
|
* @param options
|
|
@@ -416,7 +392,6 @@ export class WebAuth {
|
|
|
416
392
|
getAccessToken(options) {
|
|
417
393
|
return TokenService.getAccessToken(options);
|
|
418
394
|
}
|
|
419
|
-
;
|
|
420
395
|
/**
|
|
421
396
|
* validate access token
|
|
422
397
|
* @param options
|
|
@@ -425,7 +400,6 @@ export class WebAuth {
|
|
|
425
400
|
validateAccessToken(options) {
|
|
426
401
|
return TokenService.validateAccessToken(options);
|
|
427
402
|
}
|
|
428
|
-
;
|
|
429
403
|
/**
|
|
430
404
|
* login with username and password
|
|
431
405
|
* @param options
|
|
@@ -433,7 +407,6 @@ export class WebAuth {
|
|
|
433
407
|
loginWithCredentials(options) {
|
|
434
408
|
LoginService.loginWithCredentials(options);
|
|
435
409
|
}
|
|
436
|
-
;
|
|
437
410
|
/**
|
|
438
411
|
* login with social
|
|
439
412
|
* @param options
|
|
@@ -442,7 +415,6 @@ export class WebAuth {
|
|
|
442
415
|
loginWithSocial(options, queryParams) {
|
|
443
416
|
LoginService.loginWithSocial(options, queryParams);
|
|
444
417
|
}
|
|
445
|
-
;
|
|
446
418
|
/**
|
|
447
419
|
* register with social
|
|
448
420
|
* @param options
|
|
@@ -451,7 +423,6 @@ export class WebAuth {
|
|
|
451
423
|
registerWithSocial(options, queryParams) {
|
|
452
424
|
LoginService.registerWithSocial(options, queryParams);
|
|
453
425
|
}
|
|
454
|
-
;
|
|
455
426
|
/**
|
|
456
427
|
* register user
|
|
457
428
|
* @param options
|
|
@@ -461,7 +432,6 @@ export class WebAuth {
|
|
|
461
432
|
register(options, headers) {
|
|
462
433
|
return UserService.register(options, headers);
|
|
463
434
|
}
|
|
464
|
-
;
|
|
465
435
|
/**
|
|
466
436
|
* get invite info
|
|
467
437
|
* @param options
|
|
@@ -470,7 +440,6 @@ export class WebAuth {
|
|
|
470
440
|
getInviteUserDetails(options) {
|
|
471
441
|
return UserService.getInviteUserDetails(options);
|
|
472
442
|
}
|
|
473
|
-
;
|
|
474
443
|
/**
|
|
475
444
|
* get Communication status
|
|
476
445
|
* @param options
|
|
@@ -479,7 +448,6 @@ export class WebAuth {
|
|
|
479
448
|
getCommunicationStatus(options, headers) {
|
|
480
449
|
return UserService.getCommunicationStatus(options, headers);
|
|
481
450
|
}
|
|
482
|
-
;
|
|
483
451
|
/**
|
|
484
452
|
* initiate verification
|
|
485
453
|
* @param options
|
|
@@ -488,7 +456,6 @@ export class WebAuth {
|
|
|
488
456
|
initiateAccountVerification(options) {
|
|
489
457
|
VerificationService.initiateAccountVerification(options);
|
|
490
458
|
}
|
|
491
|
-
;
|
|
492
459
|
/**
|
|
493
460
|
* verify account
|
|
494
461
|
* @param options
|
|
@@ -497,7 +464,6 @@ export class WebAuth {
|
|
|
497
464
|
verifyAccount(options) {
|
|
498
465
|
return VerificationService.verifyAccount(options);
|
|
499
466
|
}
|
|
500
|
-
;
|
|
501
467
|
/**
|
|
502
468
|
* initiate reset password
|
|
503
469
|
* @param options
|
|
@@ -506,7 +472,6 @@ export class WebAuth {
|
|
|
506
472
|
initiateResetPassword(options) {
|
|
507
473
|
return UserService.initiateResetPassword(options);
|
|
508
474
|
}
|
|
509
|
-
;
|
|
510
475
|
/**
|
|
511
476
|
* handle reset password
|
|
512
477
|
* @param options
|
|
@@ -514,7 +479,6 @@ export class WebAuth {
|
|
|
514
479
|
handleResetPassword(options) {
|
|
515
480
|
return UserService.handleResetPassword(options);
|
|
516
481
|
}
|
|
517
|
-
;
|
|
518
482
|
/**
|
|
519
483
|
* reset password
|
|
520
484
|
* @param options
|
|
@@ -522,7 +486,6 @@ export class WebAuth {
|
|
|
522
486
|
resetPassword(options) {
|
|
523
487
|
return UserService.resetPassword(options);
|
|
524
488
|
}
|
|
525
|
-
;
|
|
526
489
|
/**
|
|
527
490
|
* get mfa list
|
|
528
491
|
* @param options
|
|
@@ -531,7 +494,6 @@ export class WebAuth {
|
|
|
531
494
|
getMFAList(options) {
|
|
532
495
|
return VerificationService.getMFAList(options);
|
|
533
496
|
}
|
|
534
|
-
;
|
|
535
497
|
/**
|
|
536
498
|
* cancel mfa
|
|
537
499
|
* @param options
|
|
@@ -540,7 +502,6 @@ export class WebAuth {
|
|
|
540
502
|
cancelMFA(options) {
|
|
541
503
|
return VerificationService.cancelMFA(options);
|
|
542
504
|
}
|
|
543
|
-
;
|
|
544
505
|
/**
|
|
545
506
|
* passwordless login
|
|
546
507
|
* @param options
|
|
@@ -548,7 +509,6 @@ export class WebAuth {
|
|
|
548
509
|
passwordlessLogin(options) {
|
|
549
510
|
LoginService.passwordlessLogin(options);
|
|
550
511
|
}
|
|
551
|
-
;
|
|
552
512
|
/**
|
|
553
513
|
* get user consent details
|
|
554
514
|
* @param options
|
|
@@ -557,7 +517,6 @@ export class WebAuth {
|
|
|
557
517
|
getConsentDetails(options) {
|
|
558
518
|
return ConsentService.getConsentDetails(options);
|
|
559
519
|
}
|
|
560
|
-
;
|
|
561
520
|
/**
|
|
562
521
|
* accept consent
|
|
563
522
|
* @param options
|
|
@@ -566,7 +525,6 @@ export class WebAuth {
|
|
|
566
525
|
acceptConsent(options) {
|
|
567
526
|
return ConsentService.acceptConsent(options);
|
|
568
527
|
}
|
|
569
|
-
;
|
|
570
528
|
/**
|
|
571
529
|
* get scope consent details
|
|
572
530
|
* @param options
|
|
@@ -575,7 +533,6 @@ export class WebAuth {
|
|
|
575
533
|
loginPrecheck(options) {
|
|
576
534
|
return TokenService.loginPrecheck(options);
|
|
577
535
|
}
|
|
578
|
-
;
|
|
579
536
|
/**
|
|
580
537
|
* get scope consent version details
|
|
581
538
|
* @param options
|
|
@@ -584,7 +541,6 @@ export class WebAuth {
|
|
|
584
541
|
getConsentVersionDetails(options) {
|
|
585
542
|
return ConsentService.getConsentVersionDetails(options);
|
|
586
543
|
}
|
|
587
|
-
;
|
|
588
544
|
/**
|
|
589
545
|
* accept scope Consent
|
|
590
546
|
* @param options
|
|
@@ -593,7 +549,6 @@ export class WebAuth {
|
|
|
593
549
|
acceptScopeConsent(options) {
|
|
594
550
|
return ConsentService.acceptScopeConsent(options);
|
|
595
551
|
}
|
|
596
|
-
;
|
|
597
552
|
/**
|
|
598
553
|
* accept claim Consent
|
|
599
554
|
* @param options
|
|
@@ -602,7 +557,6 @@ export class WebAuth {
|
|
|
602
557
|
acceptClaimConsent(options) {
|
|
603
558
|
return ConsentService.acceptClaimConsent(options);
|
|
604
559
|
}
|
|
605
|
-
;
|
|
606
560
|
/**
|
|
607
561
|
* revoke claim Consent
|
|
608
562
|
* @param options
|
|
@@ -611,7 +565,6 @@ export class WebAuth {
|
|
|
611
565
|
revokeClaimConsent(options) {
|
|
612
566
|
return ConsentService.revokeClaimConsent(options);
|
|
613
567
|
}
|
|
614
|
-
;
|
|
615
568
|
/**
|
|
616
569
|
* get Deduplication details
|
|
617
570
|
* @param options
|
|
@@ -620,7 +573,6 @@ export class WebAuth {
|
|
|
620
573
|
getDeduplicationDetails(options) {
|
|
621
574
|
return UserService.getDeduplicationDetails(options);
|
|
622
575
|
}
|
|
623
|
-
;
|
|
624
576
|
/**
|
|
625
577
|
* deduplication login
|
|
626
578
|
* @param options
|
|
@@ -628,7 +580,6 @@ export class WebAuth {
|
|
|
628
580
|
deduplicationLogin(options) {
|
|
629
581
|
UserService.deduplicationLogin(options);
|
|
630
582
|
}
|
|
631
|
-
;
|
|
632
583
|
/**
|
|
633
584
|
* register Deduplication
|
|
634
585
|
* @param options
|
|
@@ -637,24 +588,21 @@ export class WebAuth {
|
|
|
637
588
|
registerDeduplication(options) {
|
|
638
589
|
return UserService.registerDeduplication(options);
|
|
639
590
|
}
|
|
640
|
-
;
|
|
641
591
|
/**
|
|
642
|
-
* accepts any as the request
|
|
643
592
|
* consent continue login
|
|
644
593
|
* @param options
|
|
645
594
|
*/
|
|
646
595
|
consentContinue(options) {
|
|
647
596
|
LoginService.consentContinue(options);
|
|
648
597
|
}
|
|
649
|
-
;
|
|
650
598
|
/**
|
|
651
599
|
* mfa continue login
|
|
600
|
+
* options: PhysicalVerificationLoginRequest is not needed anymore. It is now DEPRECATED and will be removed in the next major release
|
|
652
601
|
* @param options
|
|
653
602
|
*/
|
|
654
603
|
mfaContinue(options) {
|
|
655
604
|
LoginService.mfaContinue(options);
|
|
656
605
|
}
|
|
657
|
-
;
|
|
658
606
|
/**
|
|
659
607
|
* change password continue
|
|
660
608
|
* @param options
|
|
@@ -662,7 +610,6 @@ export class WebAuth {
|
|
|
662
610
|
firstTimeChangePassword(options) {
|
|
663
611
|
LoginService.firstTimeChangePassword(options);
|
|
664
612
|
}
|
|
665
|
-
;
|
|
666
613
|
/**
|
|
667
614
|
* change password
|
|
668
615
|
* @param options
|
|
@@ -672,7 +619,6 @@ export class WebAuth {
|
|
|
672
619
|
changePassword(options, access_token) {
|
|
673
620
|
return UserService.changePassword(options, access_token);
|
|
674
621
|
}
|
|
675
|
-
;
|
|
676
622
|
/**
|
|
677
623
|
* update profile
|
|
678
624
|
* @param options
|
|
@@ -683,7 +629,6 @@ export class WebAuth {
|
|
|
683
629
|
updateProfile(options, access_token, sub) {
|
|
684
630
|
return UserService.updateProfile(options, access_token, sub);
|
|
685
631
|
}
|
|
686
|
-
;
|
|
687
632
|
/**
|
|
688
633
|
* To get user activities, call **getUserActivities()**.
|
|
689
634
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/346141453781e-get-user-activities for more details.
|
|
@@ -706,7 +651,22 @@ export class WebAuth {
|
|
|
706
651
|
*/
|
|
707
652
|
getUserActivities(options, accessToken) {
|
|
708
653
|
const serviceURL = window.webAuthSettings.authority + '/activity-streams-srv/user-activities';
|
|
709
|
-
return Helper.createHttpPromise(options, serviceURL, false, 'POST', accessToken);
|
|
654
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST', accessToken);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* To run predefined action after enrollment, call userActionOnEnrollment()
|
|
658
|
+
* @param options
|
|
659
|
+
* @param trackId
|
|
660
|
+
* @example
|
|
661
|
+
* ```js
|
|
662
|
+
* const options = {
|
|
663
|
+
* action: 'predefined action'
|
|
664
|
+
* };
|
|
665
|
+
* cidaas.userActionOnEnrollment(options, 'trackId');
|
|
666
|
+
*/
|
|
667
|
+
userActionOnEnrollment(options, trackId) {
|
|
668
|
+
const serviceURL = window.webAuthSettings.authority + '/auth-actions-srv/validation/' + trackId;
|
|
669
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST');
|
|
710
670
|
}
|
|
711
671
|
/**
|
|
712
672
|
* @param access_token
|
|
@@ -715,7 +675,6 @@ export class WebAuth {
|
|
|
715
675
|
getAllVerificationList(access_token) {
|
|
716
676
|
return VerificationService.getAllVerificationList(access_token);
|
|
717
677
|
}
|
|
718
|
-
;
|
|
719
678
|
/**
|
|
720
679
|
* initiate link accoount
|
|
721
680
|
* @param options
|
|
@@ -725,7 +684,6 @@ export class WebAuth {
|
|
|
725
684
|
initiateLinkAccount(options, access_token) {
|
|
726
685
|
return UserService.initiateLinkAccount(options, access_token);
|
|
727
686
|
}
|
|
728
|
-
;
|
|
729
687
|
/**
|
|
730
688
|
* complete link accoount
|
|
731
689
|
* @param options
|
|
@@ -735,7 +693,6 @@ export class WebAuth {
|
|
|
735
693
|
completeLinkAccount(options, access_token) {
|
|
736
694
|
return UserService.completeLinkAccount(options, access_token);
|
|
737
695
|
}
|
|
738
|
-
;
|
|
739
696
|
/**
|
|
740
697
|
* get linked users
|
|
741
698
|
* @param access_token
|
|
@@ -745,7 +702,6 @@ export class WebAuth {
|
|
|
745
702
|
getLinkedUsers(access_token, sub) {
|
|
746
703
|
return UserService.getLinkedUsers(access_token, sub);
|
|
747
704
|
}
|
|
748
|
-
;
|
|
749
705
|
/**
|
|
750
706
|
* unlink accoount
|
|
751
707
|
* @param access_token
|
|
@@ -755,7 +711,6 @@ export class WebAuth {
|
|
|
755
711
|
unlinkAccount(access_token, identityId) {
|
|
756
712
|
return UserService.unlinkAccount(access_token, identityId);
|
|
757
713
|
}
|
|
758
|
-
;
|
|
759
714
|
/**
|
|
760
715
|
* To change profile image, call **updateProfileImage()**.
|
|
761
716
|
* @example
|
|
@@ -790,9 +745,8 @@ export class WebAuth {
|
|
|
790
745
|
const formdata = new FormData(form);
|
|
791
746
|
formdata.set('image_key', options.image_key);
|
|
792
747
|
formdata.set('photo', options.photo, options.filename);
|
|
793
|
-
return Helper.createHttpPromise(options, serviceURL, undefined, 'POST', access_token, null, formdata);
|
|
748
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST', access_token, null, formdata);
|
|
794
749
|
}
|
|
795
|
-
;
|
|
796
750
|
/**
|
|
797
751
|
* enrollVerification
|
|
798
752
|
* @param options
|
|
@@ -801,7 +755,6 @@ export class WebAuth {
|
|
|
801
755
|
initiateEnrollment(options, accessToken) {
|
|
802
756
|
return VerificationService.initiateEnrollment(options, accessToken);
|
|
803
757
|
}
|
|
804
|
-
;
|
|
805
758
|
/**
|
|
806
759
|
* update the status of notification
|
|
807
760
|
* @param status_id
|
|
@@ -810,7 +763,6 @@ export class WebAuth {
|
|
|
810
763
|
getEnrollmentStatus(status_id, accessToken) {
|
|
811
764
|
return VerificationService.getEnrollmentStatus(status_id, accessToken);
|
|
812
765
|
}
|
|
813
|
-
;
|
|
814
766
|
/**
|
|
815
767
|
* enrollVerification
|
|
816
768
|
* @param options
|
|
@@ -819,7 +771,6 @@ export class WebAuth {
|
|
|
819
771
|
enrollVerification(options) {
|
|
820
772
|
return VerificationService.enrollVerification(options);
|
|
821
773
|
}
|
|
822
|
-
;
|
|
823
774
|
/**
|
|
824
775
|
* checkVerificationTypeConfigured
|
|
825
776
|
* @param options
|
|
@@ -828,7 +779,6 @@ export class WebAuth {
|
|
|
828
779
|
checkVerificationTypeConfigured(options) {
|
|
829
780
|
return VerificationService.checkVerificationTypeConfigured(options);
|
|
830
781
|
}
|
|
831
|
-
;
|
|
832
782
|
/**
|
|
833
783
|
* deleteUserAccount
|
|
834
784
|
* @param options
|
|
@@ -837,10 +787,9 @@ export class WebAuth {
|
|
|
837
787
|
deleteUserAccount(options) {
|
|
838
788
|
return UserService.deleteUserAccount(options);
|
|
839
789
|
}
|
|
840
|
-
;
|
|
841
790
|
/**
|
|
842
791
|
* getMissingFields
|
|
843
|
-
* @param trackId - required. If only trackId is given, it will get missing fields from cidaas after
|
|
792
|
+
* @param trackId - required. If only trackId is given, it will get missing fields from cidaas after succesful registration using default provider
|
|
844
793
|
* @param useSocialProvider - optional. If given, it will get missing fields from social provider after successful registration using social provider
|
|
845
794
|
*
|
|
846
795
|
* @example
|
|
@@ -860,13 +809,12 @@ export class WebAuth {
|
|
|
860
809
|
getMissingFields(trackId, useSocialProvider) {
|
|
861
810
|
if (useSocialProvider) {
|
|
862
811
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/trackinfo/" + useSocialProvider.requestId + "/" + trackId;
|
|
863
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
812
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
864
813
|
}
|
|
865
814
|
else {
|
|
866
815
|
return TokenService.getMissingFields(trackId);
|
|
867
816
|
}
|
|
868
817
|
}
|
|
869
|
-
;
|
|
870
818
|
/**
|
|
871
819
|
* progressiveRegistration
|
|
872
820
|
* @param options
|
|
@@ -876,7 +824,6 @@ export class WebAuth {
|
|
|
876
824
|
progressiveRegistration(options, headers) {
|
|
877
825
|
return LoginService.progressiveRegistration(options, headers);
|
|
878
826
|
}
|
|
879
|
-
;
|
|
880
827
|
/**
|
|
881
828
|
* loginAfterRegister
|
|
882
829
|
* @param options
|
|
@@ -884,7 +831,6 @@ export class WebAuth {
|
|
|
884
831
|
loginAfterRegister(options) {
|
|
885
832
|
LoginService.loginAfterRegister(options);
|
|
886
833
|
}
|
|
887
|
-
;
|
|
888
834
|
/**
|
|
889
835
|
* device code flow - initiate
|
|
890
836
|
*/
|
|
@@ -906,7 +852,6 @@ export class WebAuth {
|
|
|
906
852
|
userCheckExists(options) {
|
|
907
853
|
return UserService.userCheckExists(options);
|
|
908
854
|
}
|
|
909
|
-
;
|
|
910
855
|
/**
|
|
911
856
|
* To set accept language
|
|
912
857
|
* @param acceptLanguage
|
|
@@ -920,13 +865,12 @@ export class WebAuth {
|
|
|
920
865
|
* @returns
|
|
921
866
|
*/
|
|
922
867
|
initiateMFA(options, accessToken) {
|
|
923
|
-
// TODO: remove accessToken parameter in the next major release
|
|
868
|
+
// BREAKING TODO: remove accessToken parameter in the next major release
|
|
924
869
|
if (accessToken) {
|
|
925
870
|
return VerificationService.initiateMFA(options, accessToken);
|
|
926
871
|
}
|
|
927
872
|
return VerificationService.initiateMFA(options);
|
|
928
873
|
}
|
|
929
|
-
;
|
|
930
874
|
/**
|
|
931
875
|
* authenticate mfa
|
|
932
876
|
* @param options
|
|
@@ -935,12 +879,43 @@ export class WebAuth {
|
|
|
935
879
|
authenticateMFA(options) {
|
|
936
880
|
return VerificationService.authenticateMFA(options);
|
|
937
881
|
}
|
|
938
|
-
|
|
882
|
+
/**
|
|
883
|
+
* initiate verification
|
|
884
|
+
* @param options
|
|
885
|
+
* @returns
|
|
886
|
+
*/
|
|
887
|
+
initiateVerification(options, trackId, method) {
|
|
888
|
+
return VerificationService.initiateVerification(options, trackId, method);
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* configure verification
|
|
892
|
+
* @param options
|
|
893
|
+
* @returns
|
|
894
|
+
*/
|
|
895
|
+
configureVerification(options, method) {
|
|
896
|
+
return VerificationService.configureVerification(options, method);
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* configure friendly name
|
|
900
|
+
* @param options
|
|
901
|
+
* @returns
|
|
902
|
+
*/
|
|
903
|
+
configureFriendlyName(options, trackId, method) {
|
|
904
|
+
return VerificationService.configureFriendlyName(options, trackId, method);
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* login as guest
|
|
908
|
+
* @param requestId
|
|
909
|
+
* @returns
|
|
910
|
+
*/
|
|
911
|
+
actionGuestLogin(requestId) {
|
|
912
|
+
return LoginService.actionGuestLogin(requestId);
|
|
913
|
+
}
|
|
939
914
|
/**
|
|
940
915
|
* offline token check
|
|
941
916
|
*/
|
|
942
917
|
offlineTokenCheck(accessToken) {
|
|
943
918
|
return TokenService.offlineTokenCheck(accessToken);
|
|
944
919
|
}
|
|
945
|
-
;
|
|
946
920
|
}
|
|
921
|
+
exports.WebAuth = WebAuth;
|