cidaas-javascript-sdk 4.2.4 → 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 +18 -3
- package/README.md +3 -0
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +2 -9
- 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 +10 -10
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +8 -8
- 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 +1 -1
- 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 +120 -150
- 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/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -136
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -69
- 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 -246
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -249
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -471
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -278
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
- /package/dist/authentication/{authentication.model.js → Authentication.model.js} +0 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userCheckExists = exports.deleteUserAccount = exports.unlinkAccount = exports.getLinkedUsers = exports.completeLinkAccount = exports.initiateLinkAccount = exports.updateProfile = exports.changePassword = exports.registerDeduplication = exports.deduplicationLogin = exports.getDeduplicationDetails = exports.resetPassword = exports.handleResetPassword = exports.initiateResetPassword = exports.getCommunicationStatus = exports.getInviteUserDetails = exports.register = exports.getUserProfile = void 0;
|
|
4
|
+
const Helper_1 = require("../common/Helper");
|
|
5
|
+
/**
|
|
6
|
+
* To get the user profile information by using cidaas internal api, call **getUserProfile()**.
|
|
7
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2zfvjx3vtq6g6-get-user-info for more details.
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* const options = {
|
|
11
|
+
* access_token: 'your access token'
|
|
12
|
+
* }
|
|
13
|
+
* cidaas.getUserProfile(options)
|
|
14
|
+
* .then(function () {
|
|
15
|
+
* // the response will give you user profile information.
|
|
16
|
+
* }).catch(function (ex) {
|
|
17
|
+
* // your failure code here
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function getUserProfile(options) {
|
|
22
|
+
if (!options.access_token) {
|
|
23
|
+
throw new Helper_1.CustomException("access_token cannot be empty", 417);
|
|
24
|
+
}
|
|
25
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo";
|
|
26
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", options.access_token);
|
|
27
|
+
}
|
|
28
|
+
exports.getUserProfile = getUserProfile;
|
|
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_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
63
|
+
}
|
|
64
|
+
exports.register = register;
|
|
65
|
+
/**
|
|
66
|
+
* to get information about invitation details, call **getInviteUserDetails()**. This API allows to retrieve invitation details and prefill the registration form.
|
|
67
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/0b5efa5a2db5d-prefill-the-user-invitation for more details.
|
|
68
|
+
* Minimum cidaas version to use latest api is v3.100
|
|
69
|
+
* @example
|
|
70
|
+
* ```js
|
|
71
|
+
* const options = {
|
|
72
|
+
* invite_id: 'id of user invitation'
|
|
73
|
+
* callLatestAPI: 'true' // call latest api if parameter is given. By default, the older api will be called
|
|
74
|
+
* }
|
|
75
|
+
* cidaas.getInviteUserDetails(options)
|
|
76
|
+
* .then(function () {
|
|
77
|
+
* // the response will give you information about the invitation.
|
|
78
|
+
* }).catch(function (ex) {
|
|
79
|
+
* // your failure code here
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
function getInviteUserDetails(options) {
|
|
84
|
+
let _serviceURL = "";
|
|
85
|
+
if (options.callLatestAPI) {
|
|
86
|
+
_serviceURL = window.webAuthSettings.authority + "/useractions-srv/invitations/" + options.invite_id;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
_serviceURL = window.webAuthSettings.authority + "/users-srv/invite/info/" + options.invite_id;
|
|
90
|
+
}
|
|
91
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
92
|
+
}
|
|
93
|
+
exports.getInviteUserDetails = getInviteUserDetails;
|
|
94
|
+
/**
|
|
95
|
+
* Once registration successful, verify the account based on the flow. To get the details, call **getCommunicationStatus()**.
|
|
96
|
+
* @example
|
|
97
|
+
* ```js
|
|
98
|
+
* cidaas.getCommunicationStatus({
|
|
99
|
+
* sub: 'your sub', // which you will get on the registration response
|
|
100
|
+
* }).then(function (response) {
|
|
101
|
+
* // the response will give you account details once its verified.
|
|
102
|
+
* }).catch(function(ex) {
|
|
103
|
+
* // your failure code here
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
function getCommunicationStatus(options, headers) {
|
|
108
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/communication/status/" + options.sub;
|
|
109
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
110
|
+
}
|
|
111
|
+
exports.getCommunicationStatus = getCommunicationStatus;
|
|
112
|
+
/**
|
|
113
|
+
* To initiate the password resetting, call **initiateResetPassword()**. This will send verification code to your email or mobile based on the resetMedium you mentioned.
|
|
114
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
|
|
115
|
+
* @example
|
|
116
|
+
* ```js
|
|
117
|
+
* cidaas.initiateResetPassword({
|
|
118
|
+
* email: 'xxxxxx@xxx.com',
|
|
119
|
+
* processingType: ProcessingType.CODE,
|
|
120
|
+
* requestId: 'your requestId',
|
|
121
|
+
* resetMedium: ResetMedium.EMAIL
|
|
122
|
+
* }).then(function (response) {
|
|
123
|
+
* // the response will give you password reset details.
|
|
124
|
+
* }).catch(function(ex) {
|
|
125
|
+
* // your failure code here
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
function initiateResetPassword(options) {
|
|
130
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/resetpassword/initiate";
|
|
131
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
132
|
+
}
|
|
133
|
+
exports.initiateResetPassword = initiateResetPassword;
|
|
134
|
+
/**
|
|
135
|
+
* 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.
|
|
136
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3t8ztokeb7cfz-handle-reset-password for more details.
|
|
137
|
+
* @example
|
|
138
|
+
* ```js
|
|
139
|
+
* 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.';
|
|
140
|
+
* cidaas.handleResetPassword({
|
|
141
|
+
* code: 'your code in email or sms or ivr',
|
|
142
|
+
* resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
|
|
143
|
+
* }, handleResponseAsJson).then(function (response) {
|
|
144
|
+
* // the response will give you valid verification code.
|
|
145
|
+
* }).catch(function(ex) {
|
|
146
|
+
* // your failure code here
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
function handleResetPassword(options, handleResponseAsJson) {
|
|
151
|
+
try {
|
|
152
|
+
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
153
|
+
if (!handleResponseAsJson) {
|
|
154
|
+
// current handling will redirect and give query parameters
|
|
155
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
156
|
+
document.body.appendChild(form);
|
|
157
|
+
form.submit();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// older cidaas service handling return json object
|
|
161
|
+
return Helper_1.Helper.createHttpPromise(options, url, false, "POST");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (ex) {
|
|
165
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.handleResetPassword = handleResetPassword;
|
|
169
|
+
/**
|
|
170
|
+
* To finish reseting the password, call **resetPassword()**. This will allow you to change your password.
|
|
171
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qa9ny0gkzlf6y-accept-reset-password for more details.
|
|
172
|
+
* @example
|
|
173
|
+
* ```js
|
|
174
|
+
* 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.';
|
|
175
|
+
* cidaas.resetPassword({
|
|
176
|
+
* password: '123456',
|
|
177
|
+
* confirmPassword: '123456',
|
|
178
|
+
* exchangeId: 'your exchangeId', // which you will get on handle reset password response
|
|
179
|
+
* resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
|
|
180
|
+
* }).then(function (response) {
|
|
181
|
+
* // the response will give you reset password details.
|
|
182
|
+
* }).catch(function(ex) {
|
|
183
|
+
* // your failure code here
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
function resetPassword(options, handleResponseAsJson) {
|
|
188
|
+
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
189
|
+
try {
|
|
190
|
+
if (!handleResponseAsJson) {
|
|
191
|
+
// current handling will redirect and give query parameters
|
|
192
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
193
|
+
document.body.appendChild(form);
|
|
194
|
+
form.submit();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// older cidaas service handling return json object
|
|
198
|
+
return Helper_1.Helper.createHttpPromise(options, url, false, "POST");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (ex) {
|
|
202
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.resetPassword = resetPassword;
|
|
206
|
+
/**
|
|
207
|
+
* To get the list of existing users in deduplication, call **getDeduplicationDetails()**.
|
|
208
|
+
* @example
|
|
209
|
+
* ```js
|
|
210
|
+
* this.cidaas.getDeduplicationDetails({
|
|
211
|
+
* track_id: 'your track id'
|
|
212
|
+
* }).then((response) => {
|
|
213
|
+
* // the response will give you deduplication details of users.
|
|
214
|
+
* }).catch((err) => {
|
|
215
|
+
* // your failure code here
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
function getDeduplicationDetails(options) {
|
|
220
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/info/" + options.trackId;
|
|
221
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "GET");
|
|
222
|
+
}
|
|
223
|
+
exports.getDeduplicationDetails = getDeduplicationDetails;
|
|
224
|
+
/**
|
|
225
|
+
* To use the existing users in deduplication, you need to call **deduplicationLogin()**.
|
|
226
|
+
* @example
|
|
227
|
+
* ```js
|
|
228
|
+
* this.cidaas.deduplicationLogin({
|
|
229
|
+
* sub: 'your sub',
|
|
230
|
+
* requestId: 'request id from deduplication initialisation after register',
|
|
231
|
+
* trackId: 'track id from deduplication initialisation after register'
|
|
232
|
+
* })
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
function deduplicationLogin(options) {
|
|
236
|
+
try {
|
|
237
|
+
const url = window.webAuthSettings.authority + "/users-srv/deduplication/login/redirection?trackId=" + options.trackId + "&requestId=" + options.requestId + "&sub=" + options.sub;
|
|
238
|
+
const form = Helper_1.Helper.createForm(url, {});
|
|
239
|
+
document.body.appendChild(form);
|
|
240
|
+
form.submit();
|
|
241
|
+
}
|
|
242
|
+
catch (ex) {
|
|
243
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.deduplicationLogin = deduplicationLogin;
|
|
247
|
+
/**
|
|
248
|
+
* To register new user in deduplication, call **registerDeduplication()**.
|
|
249
|
+
* @example
|
|
250
|
+
* ```js
|
|
251
|
+
* this.cidaas.registerDeduplication({
|
|
252
|
+
* track_id: 'track id from deduplication initialisation after register',
|
|
253
|
+
* }).then((response) => {
|
|
254
|
+
* // the response will give you new registered deduplication user.
|
|
255
|
+
* }).catch((err) => {
|
|
256
|
+
* // your failure code here
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
function registerDeduplication(options) {
|
|
261
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/register/" + options.trackId;
|
|
262
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST");
|
|
263
|
+
}
|
|
264
|
+
exports.registerDeduplication = registerDeduplication;
|
|
265
|
+
/**
|
|
266
|
+
* To change the password, call **changePassword()**. This will allow you to change your password.
|
|
267
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/8221883241464-change-password for more details.
|
|
268
|
+
* @example
|
|
269
|
+
* ```js
|
|
270
|
+
* cidaas.changePassword({
|
|
271
|
+
* old_password: 'your old password',
|
|
272
|
+
* new_password: 'your new password',
|
|
273
|
+
* confirm_password: 'your new password',
|
|
274
|
+
* sub: 'your sub',
|
|
275
|
+
* }, 'your access token')
|
|
276
|
+
* .then(function () {
|
|
277
|
+
* // your success code
|
|
278
|
+
* }).catch(function (ex) {
|
|
279
|
+
* // your failure code
|
|
280
|
+
* });
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
function changePassword(options, access_token) {
|
|
284
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/changepassword";
|
|
285
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
286
|
+
}
|
|
287
|
+
exports.changePassword = changePassword;
|
|
288
|
+
/**
|
|
289
|
+
* To update the user profile information, call **updateProfile()**.
|
|
290
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/i3uqnxcpxr19r-update-user-profile for more details.
|
|
291
|
+
* @example
|
|
292
|
+
* ```js
|
|
293
|
+
* cidaas.updateProfile({
|
|
294
|
+
* family_name: 'Doe',
|
|
295
|
+
* given_name: 'John',
|
|
296
|
+
* provider: 'self',
|
|
297
|
+
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
298
|
+
* }, 'your access token', 'your sub').then(function () {
|
|
299
|
+
* // the response will give you updated user profile info.
|
|
300
|
+
* }).catch(function (ex) {
|
|
301
|
+
* // your failure code here
|
|
302
|
+
* });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
function updateProfile(options, access_token, sub) {
|
|
306
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/profile/" + sub;
|
|
307
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "PUT", access_token);
|
|
308
|
+
}
|
|
309
|
+
exports.updateProfile = updateProfile;
|
|
310
|
+
/**
|
|
311
|
+
* To initiate account linking, call **initiateLinkAccount()**.
|
|
312
|
+
* @example
|
|
313
|
+
* ```js
|
|
314
|
+
* const options = {
|
|
315
|
+
* master_sub: 'sub of the user who initiates the user link',
|
|
316
|
+
* user_name_to_link: 'username of the user which should get linked',
|
|
317
|
+
* user_name_type: 'type of user name to link. E.g. email'
|
|
318
|
+
* }
|
|
319
|
+
* const access_token = 'your access token'
|
|
320
|
+
* this.cidaas.initiateLinkAccount(options, access_token).then((response) => {
|
|
321
|
+
* // your success code
|
|
322
|
+
* }).catch((err) => {
|
|
323
|
+
* // your failure code here
|
|
324
|
+
* });
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
function initiateLinkAccount(options, access_token) {
|
|
328
|
+
options.user_name_type = 'email';
|
|
329
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/initiate";
|
|
330
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
331
|
+
}
|
|
332
|
+
exports.initiateLinkAccount = initiateLinkAccount;
|
|
333
|
+
/**
|
|
334
|
+
* To complete account linking, call **completeLinkAccount()**.
|
|
335
|
+
* @example
|
|
336
|
+
* ```js
|
|
337
|
+
* const options = {
|
|
338
|
+
* code: 'code which is sent to account to be linked',
|
|
339
|
+
* link_request_id: 'comes from initiateLinkAccount'
|
|
340
|
+
* }
|
|
341
|
+
* const access_token = 'your access token'
|
|
342
|
+
* this.cidaas.completeLinkAccount(options, access_token).then((response) => {
|
|
343
|
+
* // your success code
|
|
344
|
+
* }).catch((err) => {
|
|
345
|
+
* // your failure code here
|
|
346
|
+
* });
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
function completeLinkAccount(options, access_token) {
|
|
350
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/complete";
|
|
351
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
352
|
+
}
|
|
353
|
+
exports.completeLinkAccount = completeLinkAccount;
|
|
354
|
+
/**
|
|
355
|
+
* To get all the linked accounts, call **getLinkedUsers()**.
|
|
356
|
+
* @example
|
|
357
|
+
* ```js
|
|
358
|
+
* const acccess_token= 'your access token';
|
|
359
|
+
* const sub = 'your sub';
|
|
360
|
+
*
|
|
361
|
+
* cidaas.getLinkedUsers(access_token, sub)
|
|
362
|
+
* .then(function (response) {
|
|
363
|
+
* // type your code here
|
|
364
|
+
* })
|
|
365
|
+
* .catch(function (ex) {
|
|
366
|
+
* // your failure code here
|
|
367
|
+
* });
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
function getLinkedUsers(access_token, sub) {
|
|
371
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo/social/" + sub;
|
|
372
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", access_token);
|
|
373
|
+
}
|
|
374
|
+
exports.getLinkedUsers = getLinkedUsers;
|
|
375
|
+
/**
|
|
376
|
+
* To unlink an account for a user, call **unlinkAccount()**.
|
|
377
|
+
* @example
|
|
378
|
+
* ```js
|
|
379
|
+
* const acccess_token= "your access token";
|
|
380
|
+
* const identityId = "comes from getLinkedUsers";
|
|
381
|
+
*
|
|
382
|
+
* cidaas.unlinkAccount(access_token, identityId)
|
|
383
|
+
* .then(function (response) {
|
|
384
|
+
* // type your code here
|
|
385
|
+
* })
|
|
386
|
+
* .catch(function (ex) {
|
|
387
|
+
* // your failure code here
|
|
388
|
+
* });
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
function unlinkAccount(access_token, identityId) {
|
|
392
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unlink/" + identityId;
|
|
393
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "POST", access_token);
|
|
394
|
+
}
|
|
395
|
+
exports.unlinkAccount = unlinkAccount;
|
|
396
|
+
/**
|
|
397
|
+
* To delete the user account directly in the application, call **deleteUserAccount()**.
|
|
398
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/x133xdifl1sx9-schedule-user-deletion for more details.
|
|
399
|
+
* @example
|
|
400
|
+
* ```js
|
|
401
|
+
* options = {
|
|
402
|
+
* access_token: "your access token",
|
|
403
|
+
* sub: "your sub"
|
|
404
|
+
* }
|
|
405
|
+
*
|
|
406
|
+
* cidaas.deleteUserAccount(options).then(function (response) {
|
|
407
|
+
* // your success code
|
|
408
|
+
* }).catch(function(ex) {
|
|
409
|
+
* // your failure code here
|
|
410
|
+
* });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
function deleteUserAccount(options) {
|
|
414
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unregister/scheduler/schedule/" + options.sub;
|
|
415
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", options.access_token);
|
|
416
|
+
}
|
|
417
|
+
exports.deleteUserAccount = deleteUserAccount;
|
|
418
|
+
/**
|
|
419
|
+
* To check if user exists, call **userCheckExists()**.
|
|
420
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4yh82qism78xf-find-user-by-identifier for more details.
|
|
421
|
+
* @example
|
|
422
|
+
* options = {
|
|
423
|
+
* requestId: "your request id",
|
|
424
|
+
* email: "your email"
|
|
425
|
+
* }
|
|
426
|
+
*
|
|
427
|
+
* cidaas.userCheckExists(options).then(function (response) {
|
|
428
|
+
* // your success code
|
|
429
|
+
* }).catch(function(ex) {
|
|
430
|
+
* // your failure code here
|
|
431
|
+
* });
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
function userCheckExists(options) {
|
|
435
|
+
let queryParameter = '';
|
|
436
|
+
if (options.webfinger || options.rememberMe) {
|
|
437
|
+
queryParameter += '?';
|
|
438
|
+
if (options.webfinger) {
|
|
439
|
+
queryParameter += 'webfinger=' + options.webfinger;
|
|
440
|
+
if (options.rememberMe) {
|
|
441
|
+
queryParameter += '&rememberMe=' + options.rememberMe;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
else if (options.rememberMe) {
|
|
445
|
+
queryParameter += 'rememberMe=' + options.rememberMe;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const _serviceURL = window.webAuthSettings.authority + "/useractions-srv/userexistence/" + options.requestId + queryParameter;
|
|
449
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
450
|
+
}
|
|
451
|
+
exports.userCheckExists = userCheckExists;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ProcessingType } from "../common/Common.model";
|
|
2
|
+
import { CidaasUser } from "../common/User.model";
|
|
3
|
+
export interface GetUserProfileRequest {
|
|
4
|
+
/** Access token needed to authorized api call */
|
|
5
|
+
access_token: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RegisterRequest extends CidaasUser {
|
|
8
|
+
/** id which is generated during user invitation process */
|
|
9
|
+
invite_id?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GetInviteUserDetailsRequest {
|
|
12
|
+
/** id which is generated during user invitation process */
|
|
13
|
+
invite_id: string;
|
|
14
|
+
/** described whether latest api or legacy api should be called */
|
|
15
|
+
callLatestAPI?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface getCommunicationStatusRequest {
|
|
18
|
+
/** Subject (User) identifier */
|
|
19
|
+
sub: string;
|
|
20
|
+
}
|
|
21
|
+
export interface InitiateResetPasswordRequest {
|
|
22
|
+
/**
|
|
23
|
+
* Type of medium to be used to reset password
|
|
24
|
+
* BREAKING TODO: change type to ResetMedium only in next major version
|
|
25
|
+
* */
|
|
26
|
+
resetMedium: ResetMedium | string;
|
|
27
|
+
/**
|
|
28
|
+
* defines whether the password can be resetted via email link or whether the user needs to enter a code to complete the reset password process.
|
|
29
|
+
* BREAKING TODO: change type to ProcessingType only in next major version
|
|
30
|
+
* */
|
|
31
|
+
processingType: ProcessingType | string;
|
|
32
|
+
/** Email of the user */
|
|
33
|
+
email?: string;
|
|
34
|
+
/** Mobile number of the user */
|
|
35
|
+
mobile?: string;
|
|
36
|
+
/** Phone number of the user */
|
|
37
|
+
phone?: string;
|
|
38
|
+
/** Username of the user */
|
|
39
|
+
username?: string;
|
|
40
|
+
/** Request id returned from the authorization call */
|
|
41
|
+
requestId?: string;
|
|
42
|
+
/** Provider name indicating the origin of the social identity */
|
|
43
|
+
provider?: string;
|
|
44
|
+
/** Id of the reset password process */
|
|
45
|
+
resetPasswordId?: string;
|
|
46
|
+
/** Subject (User) identifier */
|
|
47
|
+
sub?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface HandleResetPasswordRequest {
|
|
50
|
+
/** Returned from the initiation of password reset call as rprq */
|
|
51
|
+
resetRequestId: string;
|
|
52
|
+
/** One time password code send to the user after the initiation of password reset is complete*/
|
|
53
|
+
code: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ResetPasswordRequest {
|
|
56
|
+
/** Returned from the initiation of password reset call as rprq */
|
|
57
|
+
resetRequestId: string;
|
|
58
|
+
/** Returned from the after handleResetPassword process is completed */
|
|
59
|
+
exchangeId: string;
|
|
60
|
+
/** New password to be applied to the user */
|
|
61
|
+
password: string;
|
|
62
|
+
/** Confirmation of New password to be applied to the user */
|
|
63
|
+
confirmPassword: string;
|
|
64
|
+
/** Provider name indicating the origin of the social identity */
|
|
65
|
+
provider?: string;
|
|
66
|
+
/** Request id returned from the authorization call */
|
|
67
|
+
requestId?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface GetDeduplicationDetailsRequest {
|
|
70
|
+
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
71
|
+
trackId: string;
|
|
72
|
+
}
|
|
73
|
+
export interface RegisterDeduplicationRequest {
|
|
74
|
+
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
75
|
+
trackId: string;
|
|
76
|
+
}
|
|
77
|
+
export interface DeduplicationLoginRequest {
|
|
78
|
+
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
79
|
+
trackId: string;
|
|
80
|
+
/** Request id returned from the authorization call */
|
|
81
|
+
requestId: string;
|
|
82
|
+
/** Subject (User) identifier */
|
|
83
|
+
sub: string;
|
|
84
|
+
/** Password of a user */
|
|
85
|
+
password?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ChangePasswordRequest {
|
|
88
|
+
/** Subject (User) identifier */
|
|
89
|
+
sub: string;
|
|
90
|
+
/** Unique id of the users identity */
|
|
91
|
+
identityId?: string;
|
|
92
|
+
/** Old password of user */
|
|
93
|
+
old_password: string;
|
|
94
|
+
/** New password for user */
|
|
95
|
+
new_password: string;
|
|
96
|
+
/** Confirmation of user's new password */
|
|
97
|
+
confirm_password: string;
|
|
98
|
+
}
|
|
99
|
+
export interface InitiateLinkAccountRequest {
|
|
100
|
+
/** sub of the user who initiates the user link */
|
|
101
|
+
master_sub: string;
|
|
102
|
+
/** type of user name to link. E.g. email */
|
|
103
|
+
user_name_type: string;
|
|
104
|
+
/** username of the user which should get linked */
|
|
105
|
+
user_name_to_link: string;
|
|
106
|
+
}
|
|
107
|
+
export interface DeleteUserAccountRequest {
|
|
108
|
+
/** Access token needed to authorized api call */
|
|
109
|
+
access_token?: string;
|
|
110
|
+
/** Subject (User) identifier */
|
|
111
|
+
sub: string;
|
|
112
|
+
}
|
|
113
|
+
export interface CompleteLinkAccountRequest {
|
|
114
|
+
/** code will be sent to account to be linked */
|
|
115
|
+
code?: string;
|
|
116
|
+
/** value comes from initiateLinkAccount */
|
|
117
|
+
link_request_id?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface UserCheckExistsRequest {
|
|
120
|
+
/** Request id returned from the authorization call */
|
|
121
|
+
requestId?: string;
|
|
122
|
+
/** Email of user */
|
|
123
|
+
email?: string;
|
|
124
|
+
/** Username of user */
|
|
125
|
+
username?: string;
|
|
126
|
+
/** Mobile number of user */
|
|
127
|
+
mobile?: string;
|
|
128
|
+
/** Custom predefined property to identify user */
|
|
129
|
+
customFields?: {
|
|
130
|
+
[key: string]: string;
|
|
131
|
+
};
|
|
132
|
+
/** If filled, will be sent as query parameter */
|
|
133
|
+
rememberMe?: string;
|
|
134
|
+
/** If filled, will be sent as query parameter */
|
|
135
|
+
webfinger?: string;
|
|
136
|
+
}
|
|
137
|
+
/** Type of medium to be used to reset password */
|
|
138
|
+
export declare enum ResetMedium {
|
|
139
|
+
'SMS' = 0,
|
|
140
|
+
'EMAIL' = 1,
|
|
141
|
+
'IVR' = 2
|
|
142
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResetMedium = void 0;
|
|
4
|
+
/** Type of medium to be used to reset password */
|
|
5
|
+
var ResetMedium;
|
|
6
|
+
(function (ResetMedium) {
|
|
7
|
+
ResetMedium[ResetMedium["SMS"] = 0] = "SMS";
|
|
8
|
+
ResetMedium[ResetMedium["EMAIL"] = 1] = "EMAIL";
|
|
9
|
+
ResetMedium[ResetMedium["IVR"] = 2] = "IVR";
|
|
10
|
+
})(ResetMedium = exports.ResetMedium || (exports.ResetMedium = {}));
|