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
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
import { Helper, CustomException } from "./Helper";
|
|
2
|
-
export var UserService;
|
|
3
|
-
(function (UserService) {
|
|
4
|
-
/**
|
|
5
|
-
* To get the user profile information by using cidaas internal api, call **getUserProfile()**.
|
|
6
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2zfvjx3vtq6g6-get-user-info for more details.
|
|
7
|
-
* @example
|
|
8
|
-
* ```js
|
|
9
|
-
* const options = {
|
|
10
|
-
* access_token: 'your access token'
|
|
11
|
-
* }
|
|
12
|
-
* cidaas.getUserProfile(options)
|
|
13
|
-
* .then(function () {
|
|
14
|
-
* // the response will give you user profile information.
|
|
15
|
-
* }).catch(function (ex) {
|
|
16
|
-
* // your failure code here
|
|
17
|
-
* });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function getUserProfile(options) {
|
|
21
|
-
if (!options.access_token) {
|
|
22
|
-
throw new CustomException("access_token cannot be empty", 417);
|
|
23
|
-
}
|
|
24
|
-
const _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo";
|
|
25
|
-
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", options.access_token);
|
|
26
|
-
}
|
|
27
|
-
UserService.getUserProfile = getUserProfile;
|
|
28
|
-
;
|
|
29
|
-
/**
|
|
30
|
-
* To register user, call **register()**. This method will create a new user.
|
|
31
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/427632e587203-register-a-new-user for more details.
|
|
32
|
-
* Note: Only requestId in the headers is required.
|
|
33
|
-
* @example
|
|
34
|
-
* ```js
|
|
35
|
-
* const headers = {
|
|
36
|
-
* requestId: 'your_received_requestId',
|
|
37
|
-
* captcha: 'captcha',
|
|
38
|
-
* acceptlanguage: 'acceptlanguage',
|
|
39
|
-
* bot_captcha_response: 'bot_captcha_response'
|
|
40
|
-
* };
|
|
41
|
-
*
|
|
42
|
-
* cidaas.register({
|
|
43
|
-
* email: 'xxx123@xxx.com',
|
|
44
|
-
* given_name: 'xxxxx',
|
|
45
|
-
* family_name: 'yyyyy',
|
|
46
|
-
* password: '123456',
|
|
47
|
-
* password_echo: '123456',
|
|
48
|
-
* provider: 'your provider', // FACEBOOK, GOOGLE, SELF
|
|
49
|
-
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
50
|
-
* }, headers).then(function (response) {
|
|
51
|
-
* // the response will give you client registration details.
|
|
52
|
-
* }).catch(function(ex) {
|
|
53
|
-
* // your failure code here
|
|
54
|
-
* });
|
|
55
|
-
*```
|
|
56
|
-
*/
|
|
57
|
-
function register(options, headers) {
|
|
58
|
-
let _serviceURL = window.webAuthSettings.authority + "/users-srv/register";
|
|
59
|
-
if (options.invite_id) {
|
|
60
|
-
_serviceURL = _serviceURL + "?invite_id=" + options.invite_id;
|
|
61
|
-
}
|
|
62
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
63
|
-
}
|
|
64
|
-
UserService.register = register;
|
|
65
|
-
;
|
|
66
|
-
/**
|
|
67
|
-
* to get information about invitation details, call **getInviteUserDetails()**. This API allows to retrieve invitation details and prefill the registration form.
|
|
68
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/0b5efa5a2db5d-prefill-the-user-invitation for more details.
|
|
69
|
-
* Minimum cidaas version to use latest api is v3.100
|
|
70
|
-
* @example
|
|
71
|
-
* ```js
|
|
72
|
-
* const options = {
|
|
73
|
-
* invite_id: 'id of user invitation'
|
|
74
|
-
* callLatestAPI: 'true' // call latest api if parameter is given. By default, the older api will be called
|
|
75
|
-
* }
|
|
76
|
-
* cidaas.getInviteUserDetails(options)
|
|
77
|
-
* .then(function () {
|
|
78
|
-
* // the response will give you information about the invitation.
|
|
79
|
-
* }).catch(function (ex) {
|
|
80
|
-
* // your failure code here
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
function getInviteUserDetails(options) {
|
|
85
|
-
let _serviceURL = "";
|
|
86
|
-
if (options.callLatestAPI) {
|
|
87
|
-
_serviceURL = window.webAuthSettings.authority + "/useractions-srv/invitations/" + options.invite_id;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
_serviceURL = window.webAuthSettings.authority + "/users-srv/invite/info/" + options.invite_id;
|
|
91
|
-
}
|
|
92
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
93
|
-
}
|
|
94
|
-
UserService.getInviteUserDetails = getInviteUserDetails;
|
|
95
|
-
;
|
|
96
|
-
/**
|
|
97
|
-
* Once registration successful, verify the account based on the flow. To get the details, call **getCommunicationStatus()**.
|
|
98
|
-
* @example
|
|
99
|
-
* ```js
|
|
100
|
-
* cidaas.getCommunicationStatus({
|
|
101
|
-
* sub: 'your sub', // which you will get on the registration response
|
|
102
|
-
* }).then(function (response) {
|
|
103
|
-
* // the response will give you account details once its verified.
|
|
104
|
-
* }).catch(function(ex) {
|
|
105
|
-
* // your failure code here
|
|
106
|
-
* });
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
function getCommunicationStatus(options, headers) {
|
|
110
|
-
let _serviceURL = window.webAuthSettings.authority + "/users-srv/user/communication/status/" + options.sub;
|
|
111
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
112
|
-
}
|
|
113
|
-
UserService.getCommunicationStatus = getCommunicationStatus;
|
|
114
|
-
;
|
|
115
|
-
/**
|
|
116
|
-
* To initiate the password resetting, call **initiateResetPassword()**. This will send verification code to your email or mobile based on the resetMedium you mentioned.
|
|
117
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
|
|
118
|
-
* @example
|
|
119
|
-
* ```js
|
|
120
|
-
* cidaas.initiateResetPassword({
|
|
121
|
-
* email: 'xxxxxx@xxx.com',
|
|
122
|
-
* processingType: 'CODE',
|
|
123
|
-
* requestId: 'your requestId',
|
|
124
|
-
* resetMedium: 'email'
|
|
125
|
-
* }).then(function (response) {
|
|
126
|
-
* // the response will give you password reset details.
|
|
127
|
-
* }).catch(function(ex) {
|
|
128
|
-
* // your failure code here
|
|
129
|
-
* });
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
function initiateResetPassword(options) {
|
|
133
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/resetpassword/initiate";
|
|
134
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
135
|
-
}
|
|
136
|
-
UserService.initiateResetPassword = initiateResetPassword;
|
|
137
|
-
;
|
|
138
|
-
/**
|
|
139
|
-
* To handle the reset password by entering the verification code you received, call **handleResetPassword()**. This will check if your verification code was valid or not, and allows you to proceed to the next step.
|
|
140
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3t8ztokeb7cfz-handle-reset-password for more details.
|
|
141
|
-
* @example
|
|
142
|
-
* ```js
|
|
143
|
-
* const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, the response information will be given as query parameter in redirect url.';
|
|
144
|
-
* cidaas.handleResetPassword({
|
|
145
|
-
* code: 'your code in email or sms or ivr',
|
|
146
|
-
* resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
|
|
147
|
-
* }, handleResponseAsJson).then(function (response) {
|
|
148
|
-
* // the response will give you valid verification code.
|
|
149
|
-
* }).catch(function(ex) {
|
|
150
|
-
* // your failure code here
|
|
151
|
-
* });
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
function handleResetPassword(options, handleResponseAsJson) {
|
|
155
|
-
try {
|
|
156
|
-
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
157
|
-
if (!handleResponseAsJson) {
|
|
158
|
-
// current handling will redirect and give query parameters
|
|
159
|
-
let form = Helper.createForm(url, options);
|
|
160
|
-
document.body.appendChild(form);
|
|
161
|
-
form.submit();
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// older cidaas service handling return json object
|
|
165
|
-
return Helper.createHttpPromise(options, url, false, "POST");
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
catch (ex) {
|
|
169
|
-
throw new CustomException(ex, 417);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
UserService.handleResetPassword = handleResetPassword;
|
|
173
|
-
;
|
|
174
|
-
/**
|
|
175
|
-
* To finish reseting the password, call **resetPassword()**. This will allow you to change your password.
|
|
176
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qa9ny0gkzlf6y-accept-reset-password for more details.
|
|
177
|
-
* @example
|
|
178
|
-
* ```js
|
|
179
|
-
* const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, user will be redirected to success page after successful reset password.';
|
|
180
|
-
* cidaas.resetPassword({
|
|
181
|
-
* password: '123456',
|
|
182
|
-
* confirmPassword: '123456',
|
|
183
|
-
* exchangeId: 'your exchangeId', // which you will get on handle reset password response
|
|
184
|
-
* resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
|
|
185
|
-
* }).then(function (response) {
|
|
186
|
-
* // the response will give you reset password details.
|
|
187
|
-
* }).catch(function(ex) {
|
|
188
|
-
* // your failure code here
|
|
189
|
-
* });
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
function resetPassword(options, handleResponseAsJson) {
|
|
193
|
-
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
194
|
-
try {
|
|
195
|
-
if (!handleResponseAsJson) {
|
|
196
|
-
// current handling will redirect and give query parameters
|
|
197
|
-
let form = Helper.createForm(url, options);
|
|
198
|
-
document.body.appendChild(form);
|
|
199
|
-
form.submit();
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
// older cidaas service handling return json object
|
|
203
|
-
return Helper.createHttpPromise(options, url, false, "POST");
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
catch (ex) {
|
|
207
|
-
throw new CustomException(ex, 417);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
UserService.resetPassword = resetPassword;
|
|
211
|
-
;
|
|
212
|
-
/**
|
|
213
|
-
* To get the list of existing users in deduplication, call **getDeduplicationDetails()**.
|
|
214
|
-
* @example
|
|
215
|
-
* ```js
|
|
216
|
-
* this.cidaas.getDeduplicationDetails({
|
|
217
|
-
* track_id: 'your track id'
|
|
218
|
-
* }).then((response) => {
|
|
219
|
-
* // the response will give you deduplication details of users.
|
|
220
|
-
* }).catch((err) => {
|
|
221
|
-
* // your failure code here
|
|
222
|
-
* });
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
function getDeduplicationDetails(options) {
|
|
226
|
-
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/info/" + options.trackId;
|
|
227
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "GET");
|
|
228
|
-
}
|
|
229
|
-
UserService.getDeduplicationDetails = getDeduplicationDetails;
|
|
230
|
-
;
|
|
231
|
-
/**
|
|
232
|
-
* To use the existing users in deduplication, you need to call **deduplicationLogin()**.
|
|
233
|
-
* @example
|
|
234
|
-
* ```js
|
|
235
|
-
* this.cidaas.deduplicationLogin({
|
|
236
|
-
* sub: 'your sub',
|
|
237
|
-
* requestId: 'request id from deduplication initialisation after register',
|
|
238
|
-
* trackId: 'track id from deduplication initialisation after register'
|
|
239
|
-
* })
|
|
240
|
-
* ```
|
|
241
|
-
*/
|
|
242
|
-
function deduplicationLogin(options) {
|
|
243
|
-
try {
|
|
244
|
-
const url = window.webAuthSettings.authority + "/users-srv/deduplication/login/redirection?trackId=" + options.trackId + "&requestId=" + options.requestId + "&sub=" + options.sub;
|
|
245
|
-
const form = Helper.createForm(url, {});
|
|
246
|
-
document.body.appendChild(form);
|
|
247
|
-
form.submit();
|
|
248
|
-
}
|
|
249
|
-
catch (ex) {
|
|
250
|
-
throw new CustomException(ex, 417);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
UserService.deduplicationLogin = deduplicationLogin;
|
|
254
|
-
;
|
|
255
|
-
/**
|
|
256
|
-
* To register new user in deduplication, call **registerDeduplication()**.
|
|
257
|
-
* @example
|
|
258
|
-
* ```js
|
|
259
|
-
* this.cidaas.registerDeduplication({
|
|
260
|
-
* track_id: 'track id from deduplication initialisation after register',
|
|
261
|
-
* }).then((response) => {
|
|
262
|
-
* // the response will give you new registered deduplication user.
|
|
263
|
-
* }).catch((err) => {
|
|
264
|
-
* // your failure code here
|
|
265
|
-
* });
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
function registerDeduplication(options) {
|
|
269
|
-
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/register/" + options.trackId;
|
|
270
|
-
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST");
|
|
271
|
-
}
|
|
272
|
-
UserService.registerDeduplication = registerDeduplication;
|
|
273
|
-
;
|
|
274
|
-
/**
|
|
275
|
-
* To change the password, call **changePassword()**. This will allow you to change your password.
|
|
276
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/8221883241464-change-password for more details.
|
|
277
|
-
* @example
|
|
278
|
-
* ```js
|
|
279
|
-
* cidaas.changePassword({
|
|
280
|
-
* old_password: 'your old password',
|
|
281
|
-
* new_password: 'your new password',
|
|
282
|
-
* confirm_password: 'your new password',
|
|
283
|
-
* sub: 'your sub',
|
|
284
|
-
* }, 'your access token')
|
|
285
|
-
* .then(function () {
|
|
286
|
-
* // your success code
|
|
287
|
-
* }).catch(function (ex) {
|
|
288
|
-
* // your failure code
|
|
289
|
-
* });
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
function changePassword(options, access_token) {
|
|
293
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/changepassword";
|
|
294
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
295
|
-
}
|
|
296
|
-
UserService.changePassword = changePassword;
|
|
297
|
-
;
|
|
298
|
-
/**
|
|
299
|
-
* To update the user profile information, call **updateProfile()**.
|
|
300
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/i3uqnxcpxr19r-update-user-profile for more details.
|
|
301
|
-
* @example
|
|
302
|
-
* ```js
|
|
303
|
-
* cidaas.updateProfile({
|
|
304
|
-
* family_name: 'Doe',
|
|
305
|
-
* given_name: 'John',
|
|
306
|
-
* provider: 'self',
|
|
307
|
-
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
308
|
-
* }, 'your access token', 'your sub').then(function () {
|
|
309
|
-
* // the response will give you updated user profile info.
|
|
310
|
-
* }).catch(function (ex) {
|
|
311
|
-
* // your failure code here
|
|
312
|
-
* });
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
function updateProfile(options, access_token, sub) {
|
|
316
|
-
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/profile/" + sub;
|
|
317
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "PUT", access_token);
|
|
318
|
-
}
|
|
319
|
-
UserService.updateProfile = updateProfile;
|
|
320
|
-
;
|
|
321
|
-
/**
|
|
322
|
-
* To initiate account linking, call **initiateLinkAccount()**.
|
|
323
|
-
* @example
|
|
324
|
-
* ```js
|
|
325
|
-
* const options = {
|
|
326
|
-
* master_sub: 'sub of the user who initiates the user link',
|
|
327
|
-
* user_name_to_link: 'username of the user which should get linked',
|
|
328
|
-
* user_name_type: 'type of user name to link. E.g. email'
|
|
329
|
-
* }
|
|
330
|
-
* const access_token = 'your access token'
|
|
331
|
-
* this.cidaas.initiateLinkAccount(options, access_token).then((response) => {
|
|
332
|
-
* // your success code
|
|
333
|
-
* }).catch((err) => {
|
|
334
|
-
* // your failure code here
|
|
335
|
-
* });
|
|
336
|
-
* ```
|
|
337
|
-
*/
|
|
338
|
-
function initiateLinkAccount(options, access_token) {
|
|
339
|
-
options.user_name_type = 'email';
|
|
340
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/initiate";
|
|
341
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
342
|
-
}
|
|
343
|
-
UserService.initiateLinkAccount = initiateLinkAccount;
|
|
344
|
-
;
|
|
345
|
-
/**
|
|
346
|
-
* To complete account linking, call **completeLinkAccount()**.
|
|
347
|
-
* @example
|
|
348
|
-
* ```js
|
|
349
|
-
* const options = {
|
|
350
|
-
* code: 'code which is sent to account to be linked',
|
|
351
|
-
* link_request_id: 'comes from initiateLinkAccount'
|
|
352
|
-
* }
|
|
353
|
-
* const access_token = 'your access token'
|
|
354
|
-
* this.cidaas.completeLinkAccount(options, access_token).then((response) => {
|
|
355
|
-
* // your success code
|
|
356
|
-
* }).catch((err) => {
|
|
357
|
-
* // your failure code here
|
|
358
|
-
* });
|
|
359
|
-
* ```
|
|
360
|
-
*/
|
|
361
|
-
function completeLinkAccount(options, access_token) {
|
|
362
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/complete";
|
|
363
|
-
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
364
|
-
}
|
|
365
|
-
UserService.completeLinkAccount = completeLinkAccount;
|
|
366
|
-
;
|
|
367
|
-
/**
|
|
368
|
-
* To get all the linked accounts, call **getLinkedUsers()**.
|
|
369
|
-
* @example
|
|
370
|
-
* ```js
|
|
371
|
-
* const acccess_token= 'your access token';
|
|
372
|
-
* const sub = 'your sub';
|
|
373
|
-
*
|
|
374
|
-
* cidaas.getLinkedUsers(access_token, sub)
|
|
375
|
-
* .then(function (response) {
|
|
376
|
-
* // type your code here
|
|
377
|
-
* })
|
|
378
|
-
* .catch(function (ex) {
|
|
379
|
-
* // your failure code here
|
|
380
|
-
* });
|
|
381
|
-
* ```
|
|
382
|
-
*/
|
|
383
|
-
function getLinkedUsers(access_token, sub) {
|
|
384
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo/social/" + sub;
|
|
385
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET", access_token);
|
|
386
|
-
}
|
|
387
|
-
UserService.getLinkedUsers = getLinkedUsers;
|
|
388
|
-
;
|
|
389
|
-
/**
|
|
390
|
-
* To unlink an account for a user, call **unlinkAccount()**.
|
|
391
|
-
* @example
|
|
392
|
-
* ```js
|
|
393
|
-
* const acccess_token= "your access token";
|
|
394
|
-
* const identityId = "comes from getLinkedUsers";
|
|
395
|
-
*
|
|
396
|
-
* cidaas.unlinkAccount(access_token, identityId)
|
|
397
|
-
* .then(function (response) {
|
|
398
|
-
* // type your code here
|
|
399
|
-
* })
|
|
400
|
-
* .catch(function (ex) {
|
|
401
|
-
* // your failure code here
|
|
402
|
-
* });
|
|
403
|
-
* ```
|
|
404
|
-
*/
|
|
405
|
-
function unlinkAccount(access_token, identityId) {
|
|
406
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unlink/" + identityId;
|
|
407
|
-
return Helper.createHttpPromise(undefined, _serviceURL, false, "POST", access_token);
|
|
408
|
-
}
|
|
409
|
-
UserService.unlinkAccount = unlinkAccount;
|
|
410
|
-
;
|
|
411
|
-
/**
|
|
412
|
-
* To delete the user account directly in the application, call **deleteUserAccount()**.
|
|
413
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/x133xdifl1sx9-schedule-user-deletion for more details.
|
|
414
|
-
* @example
|
|
415
|
-
* ```js
|
|
416
|
-
* options = {
|
|
417
|
-
* access_token: "your access token",
|
|
418
|
-
* sub: "your sub"
|
|
419
|
-
* }
|
|
420
|
-
*
|
|
421
|
-
* cidaas.deleteUserAccount(options).then(function (response) {
|
|
422
|
-
* // your success code
|
|
423
|
-
* }).catch(function(ex) {
|
|
424
|
-
* // your failure code here
|
|
425
|
-
* });
|
|
426
|
-
* ```
|
|
427
|
-
*/
|
|
428
|
-
function deleteUserAccount(options) {
|
|
429
|
-
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unregister/scheduler/schedule/" + options.sub;
|
|
430
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST", options.access_token);
|
|
431
|
-
}
|
|
432
|
-
UserService.deleteUserAccount = deleteUserAccount;
|
|
433
|
-
;
|
|
434
|
-
/**
|
|
435
|
-
* To check if user exists, call **userCheckExists()**.
|
|
436
|
-
* @example
|
|
437
|
-
* options = {
|
|
438
|
-
* requestId: "your request id",
|
|
439
|
-
* email: "your email"
|
|
440
|
-
* }
|
|
441
|
-
*
|
|
442
|
-
* cidaas.userCheckExists(options).then(function (response) {
|
|
443
|
-
* // your success code
|
|
444
|
-
* }).catch(function(ex) {
|
|
445
|
-
* // your failure code here
|
|
446
|
-
* });
|
|
447
|
-
* ```
|
|
448
|
-
*/
|
|
449
|
-
function userCheckExists(options) {
|
|
450
|
-
let queryParameter = '';
|
|
451
|
-
if (options.webfinger || options.rememberMe) {
|
|
452
|
-
queryParameter += '?';
|
|
453
|
-
if (options.webfinger) {
|
|
454
|
-
queryParameter += 'webfinger=' + options.webfinger;
|
|
455
|
-
if (options.rememberMe) {
|
|
456
|
-
queryParameter += '&rememberMe=' + options.rememberMe;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
else if (options.rememberMe) {
|
|
460
|
-
queryParameter += 'rememberMe=' + options.rememberMe;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
var _serviceURL = window.webAuthSettings.authority + "/useractions-srv/userexistence/" + options.requestId + queryParameter;
|
|
464
|
-
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
465
|
-
}
|
|
466
|
-
UserService.userCheckExists = userCheckExists;
|
|
467
|
-
;
|
|
468
|
-
})(UserService || (UserService = {}));
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { IConfiguredListRequestEntity, IInitVerificationAuthenticationRequestEntity, IEnrollVerificationSetupRequestEntity, IAuthVerificationAuthenticationRequestEntity, AccountVerificationRequestEntity } from "./Entities";
|
|
2
|
-
export declare namespace VerificationService {
|
|
3
|
-
/**
|
|
4
|
-
* To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
5
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
|
|
6
|
-
* @example
|
|
7
|
-
* ```js
|
|
8
|
-
* cidaas.initiateAccountVerification({
|
|
9
|
-
* verificationMedium: 'email',
|
|
10
|
-
* requestId: 'your requestId',
|
|
11
|
-
* processingType: 'CODE',
|
|
12
|
-
* email: 'your email'
|
|
13
|
-
* }).then(function (response) {
|
|
14
|
-
* // the response will give you account verification details.
|
|
15
|
-
* }).catch(function(ex) {
|
|
16
|
-
* // your failure code here
|
|
17
|
-
* });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function initiateAccountVerification(options: AccountVerificationRequestEntity): void;
|
|
21
|
-
/**
|
|
22
|
-
* To complete the verification, call **verifyAccount()**.
|
|
23
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* cidaas.verifyAccount({
|
|
27
|
-
* accvid: 'your accvid', // which you will get on initiate account verification response
|
|
28
|
-
* code: 'your code in email or sms or ivr'
|
|
29
|
-
* }).then(function (response) {
|
|
30
|
-
* // the response will give you account verification ID and unique code.
|
|
31
|
-
* }).catch(function(ex) {
|
|
32
|
-
* // your failure code here
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
function verifyAccount(options: {
|
|
37
|
-
accvid: string;
|
|
38
|
-
code: string;
|
|
39
|
-
}): Promise<unknown>;
|
|
40
|
-
/**
|
|
41
|
-
* To get all configured multi factor authentication, call **getMFAList()**.
|
|
42
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
|
|
43
|
-
* @example
|
|
44
|
-
* ```js
|
|
45
|
-
* cidaas.getMFAList({
|
|
46
|
-
* request_id: 'your request id',
|
|
47
|
-
* email: 'your email'
|
|
48
|
-
* }).then(function (response) {
|
|
49
|
-
* // the response will give you list of configured multi factor authentication
|
|
50
|
-
* }).catch(function(ex) {
|
|
51
|
-
* // your failure code here
|
|
52
|
-
* });
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
function getMFAList(options: IConfiguredListRequestEntity): Promise<unknown>;
|
|
56
|
-
/**
|
|
57
|
-
* to cancel mfa process, call **cancelMFA()**.
|
|
58
|
-
* @example
|
|
59
|
-
* ```js
|
|
60
|
-
* cidaas.cancelMFA({
|
|
61
|
-
* exchange_id: 'exchange id from initiateMFA() response',
|
|
62
|
-
* reason: 'reason of mfa cancelation',
|
|
63
|
-
* type: 'authentication type e.g. email'
|
|
64
|
-
* }).then(function (response) {
|
|
65
|
-
* // your success code here
|
|
66
|
-
* }).catch(function(ex) {
|
|
67
|
-
* // your failure code here
|
|
68
|
-
* });
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
function cancelMFA(options: {
|
|
72
|
-
exchange_id: string;
|
|
73
|
-
reason: string;
|
|
74
|
-
type: string;
|
|
75
|
-
}): Promise<unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
|
|
78
|
-
* @example
|
|
79
|
-
* ```js
|
|
80
|
-
* const access_token = "your access token";
|
|
81
|
-
*
|
|
82
|
-
* cidaas.getAllVerificationList(access_token)
|
|
83
|
-
* .then(function (response) {
|
|
84
|
-
* // type your code here
|
|
85
|
-
* })
|
|
86
|
-
* .catch(function (ex) {
|
|
87
|
-
* // your failure code here
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
function getAllVerificationList(access_token: string): Promise<unknown>;
|
|
92
|
-
/**
|
|
93
|
-
* To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
|
|
94
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
|
|
95
|
-
* @example
|
|
96
|
-
* ```js
|
|
97
|
-
* const access_token = "your access token";
|
|
98
|
-
* const options = {
|
|
99
|
-
* verification_type: 'one of verification_type such as fido2, face, ivr',
|
|
100
|
-
* deviceInfo: {
|
|
101
|
-
* deviceId: '',
|
|
102
|
-
* location: {lat: '', lon: ''}
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
*
|
|
106
|
-
* cidaas.initiateEnrollment(options, access_token)
|
|
107
|
-
* .then(function (response) {
|
|
108
|
-
* // type your code here
|
|
109
|
-
* })
|
|
110
|
-
* .catch(function (ex) {
|
|
111
|
-
* // your failure code here
|
|
112
|
-
* });
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
function initiateEnrollment(options: {
|
|
116
|
-
verification_type: string;
|
|
117
|
-
deviceInfo?: {
|
|
118
|
-
deviceId: string;
|
|
119
|
-
location: {
|
|
120
|
-
lat: string;
|
|
121
|
-
lon: string;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
}, accessToken: string): Promise<unknown>;
|
|
125
|
-
/**
|
|
126
|
-
* to get the status of MFA enrollment, call **getEnrollmentStatus()**.
|
|
127
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
|
|
128
|
-
* @example
|
|
129
|
-
* ```js
|
|
130
|
-
* cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
|
|
131
|
-
* .then(function (response) {
|
|
132
|
-
* // type your code here
|
|
133
|
-
* })
|
|
134
|
-
* .catch(function (ex) {
|
|
135
|
-
* // your failure code here
|
|
136
|
-
* });
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
function getEnrollmentStatus(status_id: string, accessToken: string): Promise<unknown>;
|
|
140
|
-
/**
|
|
141
|
-
* to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
|
|
142
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
|
|
143
|
-
* @example
|
|
144
|
-
* ```js
|
|
145
|
-
* const fidoPayload = {
|
|
146
|
-
* sub: 'your sub',
|
|
147
|
-
* exchange_id: 'exchange_id from initiateEnrollment()',
|
|
148
|
-
* verification_type: 'fido2',
|
|
149
|
-
* fido2_client_response: {
|
|
150
|
-
* client_response: 'client_response from doing fido process',
|
|
151
|
-
* fidoRequestId: 'fidoRequestId from initiateEnrollment',
|
|
152
|
-
* }
|
|
153
|
-
* }
|
|
154
|
-
* cidaas.enrollVerification(fidoPayload)
|
|
155
|
-
* .then(function (response) {
|
|
156
|
-
* // type your code here
|
|
157
|
-
* })
|
|
158
|
-
* .catch(function (ex) {
|
|
159
|
-
* // your failure code here
|
|
160
|
-
* });
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
function enrollVerification(options: IEnrollVerificationSetupRequestEntity): Promise<unknown>;
|
|
164
|
-
/**
|
|
165
|
-
* to see details of configured verification type, call **checkVerificationTypeConfigured()**.
|
|
166
|
-
* @example
|
|
167
|
-
* ```js
|
|
168
|
-
* cidaas.checkVerificationTypeConfigured({
|
|
169
|
-
* request_id: 'your request id',
|
|
170
|
-
* email: 'your email',
|
|
171
|
-
* verification_type: 'email'
|
|
172
|
-
* }).then(function (response) {
|
|
173
|
-
* // type your code here
|
|
174
|
-
* })
|
|
175
|
-
* .catch(function (ex) {
|
|
176
|
-
* // your failure code here
|
|
177
|
-
* });
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
function checkVerificationTypeConfigured(options: IConfiguredListRequestEntity): Promise<unknown>;
|
|
181
|
-
/**
|
|
182
|
-
* to initiate multi factor auhentication, call **initiateMFA()**.
|
|
183
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
|
|
184
|
-
* @example
|
|
185
|
-
* ```js
|
|
186
|
-
* const access_token = "your access token";
|
|
187
|
-
* const options = {
|
|
188
|
-
* request_id: 'your request id',
|
|
189
|
-
* usage_type: 'PASSWORDLESS_AUTHENTICATION',
|
|
190
|
-
* type: 'email'
|
|
191
|
-
* email: 'your email'
|
|
192
|
-
* }
|
|
193
|
-
* }
|
|
194
|
-
*
|
|
195
|
-
* cidaas.initiateMFA(options, access_token)
|
|
196
|
-
* .then(function (response) {
|
|
197
|
-
* // type your code here
|
|
198
|
-
* })
|
|
199
|
-
* .catch(function (ex) {
|
|
200
|
-
* // your failure code here
|
|
201
|
-
* });
|
|
202
|
-
* ```
|
|
203
|
-
*/
|
|
204
|
-
function initiateMFA(options: IInitVerificationAuthenticationRequestEntity, accessToken?: string): Promise<unknown>;
|
|
205
|
-
/**
|
|
206
|
-
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
207
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
208
|
-
* @example
|
|
209
|
-
* ```js
|
|
210
|
-
* cidaas.authenticateMFA({
|
|
211
|
-
* type: 'email',
|
|
212
|
-
* client_id: 'your client id',
|
|
213
|
-
* exchange_id: exchange id from initiateMFA(),
|
|
214
|
-
* pass_code: 'code to authenticate'
|
|
215
|
-
* }).then(function (response) {
|
|
216
|
-
* // type your code here
|
|
217
|
-
* })
|
|
218
|
-
* .catch(function (ex) {
|
|
219
|
-
* // your failure code here
|
|
220
|
-
* });
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
function authenticateMFA(options: IAuthVerificationAuthenticationRequestEntity): Promise<unknown>;
|
|
224
|
-
}
|