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