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
|
@@ -1,249 +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.TokenService = void 0;
|
|
13
|
-
const Helper_1 = require("./Helper");
|
|
14
|
-
const JwtHelper_1 = require("./JwtHelper");
|
|
15
|
-
var TokenService;
|
|
16
|
-
(function (TokenService) {
|
|
17
|
-
/**
|
|
18
|
-
* To get a new token with the grant type refresh_token, call **renewToken()**.
|
|
19
|
-
* The refresh token to create a new token. The refresh token is received while creating an access token using the token endpoint and later can be used to fetch a new token without using credentials
|
|
20
|
-
* @example
|
|
21
|
-
* ```js
|
|
22
|
-
* const options = {
|
|
23
|
-
* refresh_token: "your refresh token",
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* cidaas.renewToken(options)
|
|
27
|
-
* .then(function (response) {
|
|
28
|
-
* // type your code here
|
|
29
|
-
* })
|
|
30
|
-
* .catch(function (ex) {
|
|
31
|
-
* // your failure code here
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
function renewToken(options) {
|
|
36
|
-
if (!options.refresh_token) {
|
|
37
|
-
throw new Helper_1.CustomException("refresh_token cannot be empty", 417);
|
|
38
|
-
}
|
|
39
|
-
options.client_id = window.webAuthSettings.client_id;
|
|
40
|
-
options.grant_type = 'refresh_token';
|
|
41
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
42
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
43
|
-
}
|
|
44
|
-
TokenService.renewToken = renewToken;
|
|
45
|
-
;
|
|
46
|
-
/**
|
|
47
|
-
* To get a new token with the grant type authorization_code, call **getAccessToken()** with code to create a new token.
|
|
48
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4ff850f48629a-generate-token for more details.
|
|
49
|
-
* @example
|
|
50
|
-
* ```js
|
|
51
|
-
* const options = {
|
|
52
|
-
* code: "your code to be exchanged with access token",
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* cidaas.getAccessToken(options)
|
|
56
|
-
* .then(function (response) {
|
|
57
|
-
* // type your code here
|
|
58
|
-
* })
|
|
59
|
-
* .catch(function (ex) {
|
|
60
|
-
* // your failure code here
|
|
61
|
-
* });
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
function getAccessToken(options) {
|
|
65
|
-
var _a;
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
if (!options.code) {
|
|
68
|
-
throw new Helper_1.CustomException("code cannot be empty", 417);
|
|
69
|
-
}
|
|
70
|
-
options.client_id = window.webAuthSettings.client_id;
|
|
71
|
-
options.redirect_uri = window.webAuthSettings.redirect_uri;
|
|
72
|
-
options.grant_type = "authorization_code";
|
|
73
|
-
if (!window.webAuthSettings.disablePKCE) {
|
|
74
|
-
var signInRequest = yield window.usermanager.getClient().createSigninRequest(window.webAuthSettings);
|
|
75
|
-
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
76
|
-
}
|
|
77
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
78
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
TokenService.getAccessToken = getAccessToken;
|
|
82
|
-
;
|
|
83
|
-
/**
|
|
84
|
-
* To validate an access token, call **validateAccessToken()**.
|
|
85
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/26ff31e2937f1-introspect-with-bearer-token for more details.
|
|
86
|
-
* @example
|
|
87
|
-
* ```js
|
|
88
|
-
* const options = {
|
|
89
|
-
* token: "your access token",
|
|
90
|
-
* token_type_hint: "accepted token type hints are access_token, id_token, refresh_token, sso",
|
|
91
|
-
* }
|
|
92
|
-
*
|
|
93
|
-
* cidaas.validateAccessToken(options)
|
|
94
|
-
* .then(function (response) {
|
|
95
|
-
* // type your code here
|
|
96
|
-
* })
|
|
97
|
-
* .catch(function (ex) {
|
|
98
|
-
* // your failure code here
|
|
99
|
-
* });
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
function validateAccessToken(options) {
|
|
103
|
-
if (!options.token || !options.token_type_hint) {
|
|
104
|
-
throw new Helper_1.CustomException("token or token_type_hint cannot be empty", 417);
|
|
105
|
-
}
|
|
106
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/introspect";
|
|
107
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", options.token);
|
|
108
|
-
}
|
|
109
|
-
TokenService.validateAccessToken = validateAccessToken;
|
|
110
|
-
;
|
|
111
|
-
/**
|
|
112
|
-
* To get precheck result after login, call **loginPrecheck()**. If there is missing information, user will be redirected to either accepting consent, changing password, continuing MFA process, or do progressive registration
|
|
113
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
114
|
-
* @example
|
|
115
|
-
* ```js
|
|
116
|
-
* const options = {
|
|
117
|
-
* trackId: "your track id from login",
|
|
118
|
-
* locale: "your preferred locale",
|
|
119
|
-
* }
|
|
120
|
-
*
|
|
121
|
-
* cidaas.loginPrecheck(options)
|
|
122
|
-
* .then(function (response) {
|
|
123
|
-
* // type your code here
|
|
124
|
-
* })
|
|
125
|
-
* .catch(function (ex) {
|
|
126
|
-
* // your failure code here
|
|
127
|
-
* });
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
function loginPrecheck(options) {
|
|
131
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id + "?acceptLanguage=" + options.locale;
|
|
132
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
133
|
-
}
|
|
134
|
-
TokenService.loginPrecheck = loginPrecheck;
|
|
135
|
-
;
|
|
136
|
-
/**
|
|
137
|
-
* To get the missing fields after login, call **getMissingFields()**.
|
|
138
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
139
|
-
* @example
|
|
140
|
-
* ```js
|
|
141
|
-
* const trackId = "your track id from login";
|
|
142
|
-
* cidaas.getMissingFields(trackId)
|
|
143
|
-
* .then(function (response) {
|
|
144
|
-
* // type your code here
|
|
145
|
-
* })
|
|
146
|
-
* .catch(function (ex) {
|
|
147
|
-
* // your failure code here
|
|
148
|
-
* });
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
function getMissingFields(trackId) {
|
|
152
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
|
|
153
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
154
|
-
}
|
|
155
|
-
TokenService.getMissingFields = getMissingFields;
|
|
156
|
-
;
|
|
157
|
-
/**
|
|
158
|
-
* To initiate device code, call **initiateDeviceCode()**.
|
|
159
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/b6d284f55be5e-authorization-request for more details.
|
|
160
|
-
* @example
|
|
161
|
-
* ```js
|
|
162
|
-
* const clientId = "your client id";
|
|
163
|
-
* cidaas.initiateDeviceCode(clientId)
|
|
164
|
-
* .then(function (response) {
|
|
165
|
-
* // type your code here
|
|
166
|
-
* })
|
|
167
|
-
* .catch(function (ex) {
|
|
168
|
-
* // your failure code here
|
|
169
|
-
* });
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
function initiateDeviceCode(clientId) {
|
|
173
|
-
const clientid = clientId !== null && clientId !== void 0 ? clientId : window.webAuthSettings.client_id;
|
|
174
|
-
const _serviceURL = `${window.webAuthSettings.authority}/authz-srv/device/authz?client_id=${clientid}`;
|
|
175
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
176
|
-
}
|
|
177
|
-
TokenService.initiateDeviceCode = initiateDeviceCode;
|
|
178
|
-
/**
|
|
179
|
-
* To verify device code, call **deviceCodeVerify()**.
|
|
180
|
-
* @example
|
|
181
|
-
* ```js
|
|
182
|
-
* const code = "your code which has been send after initiateDeviceCode()";
|
|
183
|
-
* cidaas.deviceCodeVerify(code)
|
|
184
|
-
* .then(function (response) {
|
|
185
|
-
* // type your code here
|
|
186
|
-
* })
|
|
187
|
-
* .catch(function (ex) {
|
|
188
|
-
* // your failure code here
|
|
189
|
-
* });
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
function deviceCodeVerify(code) {
|
|
193
|
-
var params = `user_code=${encodeURI(code)}`;
|
|
194
|
-
var url = `${window.webAuthSettings.authority}/token-srv/device/verify?${params}`;
|
|
195
|
-
try {
|
|
196
|
-
const options = {
|
|
197
|
-
user_code: encodeURI(code)
|
|
198
|
-
};
|
|
199
|
-
let form = Helper_1.Helper.createForm(url, options, 'GET');
|
|
200
|
-
document.body.appendChild(form);
|
|
201
|
-
form.submit();
|
|
202
|
-
}
|
|
203
|
-
catch (ex) {
|
|
204
|
-
throw new Error(ex);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
TokenService.deviceCodeVerify = deviceCodeVerify;
|
|
208
|
-
/**
|
|
209
|
-
* To check access token without having to call cidaas api, call **offlineTokenCheck()**. THe function will return true if the token is valid & false if the token is invalid.
|
|
210
|
-
* @example
|
|
211
|
-
* ```js
|
|
212
|
-
* cidaas.offlineTokenCheck('your access token');
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
|
-
function offlineTokenCheck(accessToken) {
|
|
216
|
-
var _a, _b;
|
|
217
|
-
let result = {
|
|
218
|
-
isExpiryDateValid: false,
|
|
219
|
-
isScopesValid: false,
|
|
220
|
-
isIssuerValid: false,
|
|
221
|
-
};
|
|
222
|
-
const accessTokenHeaderAsJson = JwtHelper_1.JwtHelper.decodeTokenHeader(accessToken);
|
|
223
|
-
const accessTokenAsJson = JwtHelper_1.JwtHelper.decodeToken(accessToken);
|
|
224
|
-
if (!accessTokenAsJson || !accessTokenHeaderAsJson) {
|
|
225
|
-
return result;
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
if (accessTokenAsJson.exp) {
|
|
229
|
-
const expirationDate = new Date(0);
|
|
230
|
-
expirationDate.setUTCSeconds(accessTokenAsJson.exp);
|
|
231
|
-
result.isExpiryDateValid = expirationDate.valueOf() > new Date().valueOf();
|
|
232
|
-
}
|
|
233
|
-
const accessTokenScopes = accessTokenAsJson.scopes;
|
|
234
|
-
const webAuthSettingScopes = (_b = (_a = window.webAuthSettings) === null || _a === void 0 ? void 0 : _a.scope) === null || _b === void 0 ? void 0 : _b.split(' ');
|
|
235
|
-
if ((accessTokenScopes === null || accessTokenScopes === void 0 ? void 0 : accessTokenScopes.length) === (webAuthSettingScopes === null || webAuthSettingScopes === void 0 ? void 0 : webAuthSettingScopes.length)) {
|
|
236
|
-
webAuthSettingScopes.forEach(webAuthSettingScope => {
|
|
237
|
-
const i = accessTokenScopes.indexOf(webAuthSettingScope);
|
|
238
|
-
if (i > -1) {
|
|
239
|
-
accessTokenScopes.splice(i, 1);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
result.isScopesValid = accessTokenScopes.length === 0;
|
|
243
|
-
}
|
|
244
|
-
result.isIssuerValid = accessTokenAsJson.iss === window.webAuthSettings.authority;
|
|
245
|
-
}
|
|
246
|
-
return result;
|
|
247
|
-
}
|
|
248
|
-
TokenService.offlineTokenCheck = offlineTokenCheck;
|
|
249
|
-
})(TokenService = exports.TokenService || (exports.TokenService = {}));
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { UserEntity, ResetPasswordEntity, FindUserEntity, IUserLinkEntity, ChangePasswordEntity, ValidateResetPasswordEntity, AcceptResetPasswordEntity } from "./Entities";
|
|
2
|
-
export declare namespace UserService {
|
|
3
|
-
/**
|
|
4
|
-
* To get the user profile information by using cidaas internal api, call **getUserProfile()**.
|
|
5
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2zfvjx3vtq6g6-get-user-info for more details.
|
|
6
|
-
* @example
|
|
7
|
-
* ```js
|
|
8
|
-
* const options = {
|
|
9
|
-
* access_token: 'your access token'
|
|
10
|
-
* }
|
|
11
|
-
* cidaas.getUserProfile(options)
|
|
12
|
-
* .then(function () {
|
|
13
|
-
* // the response will give you user profile information.
|
|
14
|
-
* }).catch(function (ex) {
|
|
15
|
-
* // your failure code here
|
|
16
|
-
* });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function getUserProfile(options: {
|
|
20
|
-
access_token: string;
|
|
21
|
-
}): Promise<unknown>;
|
|
22
|
-
/**
|
|
23
|
-
* To register user, call **register()**. This method will create a new user.
|
|
24
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/427632e587203-register-a-new-user for more details.
|
|
25
|
-
* Note: Only requestId in the headers is required.
|
|
26
|
-
* @example
|
|
27
|
-
* ```js
|
|
28
|
-
* const headers = {
|
|
29
|
-
* requestId: 'your_received_requestId',
|
|
30
|
-
* captcha: 'captcha',
|
|
31
|
-
* acceptlanguage: 'acceptlanguage',
|
|
32
|
-
* bot_captcha_response: 'bot_captcha_response'
|
|
33
|
-
* };
|
|
34
|
-
*
|
|
35
|
-
* cidaas.register({
|
|
36
|
-
* email: 'xxx123@xxx.com',
|
|
37
|
-
* given_name: 'xxxxx',
|
|
38
|
-
* family_name: 'yyyyy',
|
|
39
|
-
* password: '123456',
|
|
40
|
-
* password_echo: '123456',
|
|
41
|
-
* provider: 'your provider', // FACEBOOK, GOOGLE, SELF
|
|
42
|
-
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
43
|
-
* }, headers).then(function (response) {
|
|
44
|
-
* // the response will give you client registration details.
|
|
45
|
-
* }).catch(function(ex) {
|
|
46
|
-
* // your failure code here
|
|
47
|
-
* });
|
|
48
|
-
*```
|
|
49
|
-
*/
|
|
50
|
-
function register(options: UserEntity, headers: {
|
|
51
|
-
requestId: string;
|
|
52
|
-
captcha?: string;
|
|
53
|
-
acceptlanguage?: string;
|
|
54
|
-
bot_captcha_response?: string;
|
|
55
|
-
trackId?: string;
|
|
56
|
-
}): Promise<unknown>;
|
|
57
|
-
/**
|
|
58
|
-
* to get information about invitation details, call **getInviteUserDetails()**. This API allows to retrieve invitation details and prefill the registration form.
|
|
59
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/0b5efa5a2db5d-prefill-the-user-invitation for more details.
|
|
60
|
-
* Minimum cidaas version to use latest api is v3.100
|
|
61
|
-
* @example
|
|
62
|
-
* ```js
|
|
63
|
-
* const options = {
|
|
64
|
-
* invite_id: 'id of user invitation'
|
|
65
|
-
* callLatestAPI: 'true' // call latest api if parameter is given. By default, the older api will be called
|
|
66
|
-
* }
|
|
67
|
-
* cidaas.getInviteUserDetails(options)
|
|
68
|
-
* .then(function () {
|
|
69
|
-
* // the response will give you information about the invitation.
|
|
70
|
-
* }).catch(function (ex) {
|
|
71
|
-
* // your failure code here
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
function getInviteUserDetails(options: {
|
|
76
|
-
invite_id: string;
|
|
77
|
-
callLatestAPI?: boolean;
|
|
78
|
-
}): Promise<unknown>;
|
|
79
|
-
/**
|
|
80
|
-
* Once registration successful, verify the account based on the flow. To get the details, call **getCommunicationStatus()**.
|
|
81
|
-
* @example
|
|
82
|
-
* ```js
|
|
83
|
-
* cidaas.getCommunicationStatus({
|
|
84
|
-
* sub: 'your sub', // which you will get on the registration response
|
|
85
|
-
* }).then(function (response) {
|
|
86
|
-
* // the response will give you account details once its verified.
|
|
87
|
-
* }).catch(function(ex) {
|
|
88
|
-
* // your failure code here
|
|
89
|
-
* });
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
function getCommunicationStatus(options: {
|
|
93
|
-
sub: string;
|
|
94
|
-
}, headers?: {
|
|
95
|
-
requestId: string;
|
|
96
|
-
}): Promise<unknown>;
|
|
97
|
-
/**
|
|
98
|
-
* To initiate the password resetting, call **initiateResetPassword()**. This will send verification code to your email or mobile based on the resetMedium you mentioned.
|
|
99
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
|
|
100
|
-
* @example
|
|
101
|
-
* ```js
|
|
102
|
-
* cidaas.initiateResetPassword({
|
|
103
|
-
* email: 'xxxxxx@xxx.com',
|
|
104
|
-
* processingType: 'CODE',
|
|
105
|
-
* requestId: 'your requestId',
|
|
106
|
-
* resetMedium: 'email'
|
|
107
|
-
* }).then(function (response) {
|
|
108
|
-
* // the response will give you password reset details.
|
|
109
|
-
* }).catch(function(ex) {
|
|
110
|
-
* // your failure code here
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
function initiateResetPassword(options: ResetPasswordEntity): Promise<unknown>;
|
|
115
|
-
/**
|
|
116
|
-
* 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.
|
|
117
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3t8ztokeb7cfz-handle-reset-password for more details.
|
|
118
|
-
* @example
|
|
119
|
-
* ```js
|
|
120
|
-
* 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.';
|
|
121
|
-
* cidaas.handleResetPassword({
|
|
122
|
-
* code: 'your code in email or sms or ivr',
|
|
123
|
-
* resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
|
|
124
|
-
* }, handleResponseAsJson).then(function (response) {
|
|
125
|
-
* // the response will give you valid verification code.
|
|
126
|
-
* }).catch(function(ex) {
|
|
127
|
-
* // your failure code here
|
|
128
|
-
* });
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
function handleResetPassword(options: ValidateResetPasswordEntity, handleResponseAsJson?: boolean): Promise<unknown>;
|
|
132
|
-
/**
|
|
133
|
-
* To finish reseting the password, call **resetPassword()**. This will allow you to change your password.
|
|
134
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qa9ny0gkzlf6y-accept-reset-password for more details.
|
|
135
|
-
* @example
|
|
136
|
-
* ```js
|
|
137
|
-
* 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.';
|
|
138
|
-
* cidaas.resetPassword({
|
|
139
|
-
* password: '123456',
|
|
140
|
-
* confirmPassword: '123456',
|
|
141
|
-
* exchangeId: 'your exchangeId', // which you will get on handle reset password response
|
|
142
|
-
* resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
|
|
143
|
-
* }).then(function (response) {
|
|
144
|
-
* // the response will give you reset password details.
|
|
145
|
-
* }).catch(function(ex) {
|
|
146
|
-
* // your failure code here
|
|
147
|
-
* });
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
function resetPassword(options: AcceptResetPasswordEntity, handleResponseAsJson?: boolean): Promise<unknown>;
|
|
151
|
-
/**
|
|
152
|
-
* To get the list of existing users in deduplication, call **getDeduplicationDetails()**.
|
|
153
|
-
* @example
|
|
154
|
-
* ```js
|
|
155
|
-
* this.cidaas.getDeduplicationDetails({
|
|
156
|
-
* track_id: 'your track id'
|
|
157
|
-
* }).then((response) => {
|
|
158
|
-
* // the response will give you deduplication details of users.
|
|
159
|
-
* }).catch((err) => {
|
|
160
|
-
* // your failure code here
|
|
161
|
-
* });
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
function getDeduplicationDetails(options: {
|
|
165
|
-
trackId: string;
|
|
166
|
-
}): Promise<unknown>;
|
|
167
|
-
/**
|
|
168
|
-
* To use the existing users in deduplication, you need to call **deduplicationLogin()**.
|
|
169
|
-
* @example
|
|
170
|
-
* ```js
|
|
171
|
-
* this.cidaas.deduplicationLogin({
|
|
172
|
-
* sub: 'your sub',
|
|
173
|
-
* requestId: 'request id from deduplication initialisation after register',
|
|
174
|
-
* trackId: 'track id from deduplication initialisation after register'
|
|
175
|
-
* })
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
function deduplicationLogin(options: {
|
|
179
|
-
trackId: string;
|
|
180
|
-
requestId: string;
|
|
181
|
-
sub: string;
|
|
182
|
-
}): void;
|
|
183
|
-
/**
|
|
184
|
-
* To register new user in deduplication, call **registerDeduplication()**.
|
|
185
|
-
* @example
|
|
186
|
-
* ```js
|
|
187
|
-
* this.cidaas.registerDeduplication({
|
|
188
|
-
* track_id: 'track id from deduplication initialisation after register',
|
|
189
|
-
* }).then((response) => {
|
|
190
|
-
* // the response will give you new registered deduplication user.
|
|
191
|
-
* }).catch((err) => {
|
|
192
|
-
* // your failure code here
|
|
193
|
-
* });
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
function registerDeduplication(options: {
|
|
197
|
-
trackId: string;
|
|
198
|
-
}): Promise<unknown>;
|
|
199
|
-
/**
|
|
200
|
-
* To change the password, call **changePassword()**. This will allow you to change your password.
|
|
201
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/8221883241464-change-password for more details.
|
|
202
|
-
* @example
|
|
203
|
-
* ```js
|
|
204
|
-
* cidaas.changePassword({
|
|
205
|
-
* old_password: 'your old password',
|
|
206
|
-
* new_password: 'your new password',
|
|
207
|
-
* confirm_password: 'your new password',
|
|
208
|
-
* sub: 'your sub',
|
|
209
|
-
* }, 'your access token')
|
|
210
|
-
* .then(function () {
|
|
211
|
-
* // your success code
|
|
212
|
-
* }).catch(function (ex) {
|
|
213
|
-
* // your failure code
|
|
214
|
-
* });
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
function changePassword(options: ChangePasswordEntity, access_token: string): Promise<unknown>;
|
|
218
|
-
/**
|
|
219
|
-
* To update the user profile information, call **updateProfile()**.
|
|
220
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/i3uqnxcpxr19r-update-user-profile for more details.
|
|
221
|
-
* @example
|
|
222
|
-
* ```js
|
|
223
|
-
* cidaas.updateProfile({
|
|
224
|
-
* family_name: 'Doe',
|
|
225
|
-
* given_name: 'John',
|
|
226
|
-
* provider: 'self',
|
|
227
|
-
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
228
|
-
* }, 'your access token', 'your sub').then(function () {
|
|
229
|
-
* // the response will give you updated user profile info.
|
|
230
|
-
* }).catch(function (ex) {
|
|
231
|
-
* // your failure code here
|
|
232
|
-
* });
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
function updateProfile(options: UserEntity, access_token: string, sub: string): Promise<unknown>;
|
|
236
|
-
/**
|
|
237
|
-
* To initiate account linking, call **initiateLinkAccount()**.
|
|
238
|
-
* @example
|
|
239
|
-
* ```js
|
|
240
|
-
* const options = {
|
|
241
|
-
* master_sub: 'sub of the user who initiates the user link',
|
|
242
|
-
* user_name_to_link: 'username of the user which should get linked',
|
|
243
|
-
* user_name_type: 'type of user name to link. E.g. email'
|
|
244
|
-
* }
|
|
245
|
-
* const access_token = 'your access token'
|
|
246
|
-
* this.cidaas.initiateLinkAccount(options, access_token).then((response) => {
|
|
247
|
-
* // your success code
|
|
248
|
-
* }).catch((err) => {
|
|
249
|
-
* // your failure code here
|
|
250
|
-
* });
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
function initiateLinkAccount(options: IUserLinkEntity, access_token: string): Promise<unknown>;
|
|
254
|
-
/**
|
|
255
|
-
* To complete account linking, call **completeLinkAccount()**.
|
|
256
|
-
* @example
|
|
257
|
-
* ```js
|
|
258
|
-
* const options = {
|
|
259
|
-
* code: 'code which is sent to account to be linked',
|
|
260
|
-
* link_request_id: 'comes from initiateLinkAccount'
|
|
261
|
-
* }
|
|
262
|
-
* const access_token = 'your access token'
|
|
263
|
-
* this.cidaas.completeLinkAccount(options, access_token).then((response) => {
|
|
264
|
-
* // your success code
|
|
265
|
-
* }).catch((err) => {
|
|
266
|
-
* // your failure code here
|
|
267
|
-
* });
|
|
268
|
-
* ```
|
|
269
|
-
*/
|
|
270
|
-
function completeLinkAccount(options: {
|
|
271
|
-
code?: string;
|
|
272
|
-
link_request_id?: string;
|
|
273
|
-
}, access_token: string): Promise<unknown>;
|
|
274
|
-
/**
|
|
275
|
-
* To get all the linked accounts, call **getLinkedUsers()**.
|
|
276
|
-
* @example
|
|
277
|
-
* ```js
|
|
278
|
-
* const acccess_token= 'your access token';
|
|
279
|
-
* const sub = 'your sub';
|
|
280
|
-
*
|
|
281
|
-
* cidaas.getLinkedUsers(access_token, sub)
|
|
282
|
-
* .then(function (response) {
|
|
283
|
-
* // type your code here
|
|
284
|
-
* })
|
|
285
|
-
* .catch(function (ex) {
|
|
286
|
-
* // your failure code here
|
|
287
|
-
* });
|
|
288
|
-
* ```
|
|
289
|
-
*/
|
|
290
|
-
function getLinkedUsers(access_token: string, sub: string): Promise<unknown>;
|
|
291
|
-
/**
|
|
292
|
-
* To unlink an account for a user, call **unlinkAccount()**.
|
|
293
|
-
* @example
|
|
294
|
-
* ```js
|
|
295
|
-
* const acccess_token= "your access token";
|
|
296
|
-
* const identityId = "comes from getLinkedUsers";
|
|
297
|
-
*
|
|
298
|
-
* cidaas.unlinkAccount(access_token, identityId)
|
|
299
|
-
* .then(function (response) {
|
|
300
|
-
* // type your code here
|
|
301
|
-
* })
|
|
302
|
-
* .catch(function (ex) {
|
|
303
|
-
* // your failure code here
|
|
304
|
-
* });
|
|
305
|
-
* ```
|
|
306
|
-
*/
|
|
307
|
-
function unlinkAccount(access_token: string, identityId: string): Promise<unknown>;
|
|
308
|
-
/**
|
|
309
|
-
* To delete the user account directly in the application, call **deleteUserAccount()**.
|
|
310
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/x133xdifl1sx9-schedule-user-deletion for more details.
|
|
311
|
-
* @example
|
|
312
|
-
* ```js
|
|
313
|
-
* options = {
|
|
314
|
-
* access_token: "your access token",
|
|
315
|
-
* sub: "your sub"
|
|
316
|
-
* }
|
|
317
|
-
*
|
|
318
|
-
* cidaas.deleteUserAccount(options).then(function (response) {
|
|
319
|
-
* // your success code
|
|
320
|
-
* }).catch(function(ex) {
|
|
321
|
-
* // your failure code here
|
|
322
|
-
* });
|
|
323
|
-
* ```
|
|
324
|
-
*/
|
|
325
|
-
function deleteUserAccount(options: {
|
|
326
|
-
access_token: string;
|
|
327
|
-
sub: string;
|
|
328
|
-
}): Promise<unknown>;
|
|
329
|
-
/**
|
|
330
|
-
* To check if user exists, call **userCheckExists()**.
|
|
331
|
-
* @example
|
|
332
|
-
* options = {
|
|
333
|
-
* requestId: "your request id",
|
|
334
|
-
* email: "your email"
|
|
335
|
-
* }
|
|
336
|
-
*
|
|
337
|
-
* cidaas.userCheckExists(options).then(function (response) {
|
|
338
|
-
* // your success code
|
|
339
|
-
* }).catch(function(ex) {
|
|
340
|
-
* // your failure code here
|
|
341
|
-
* });
|
|
342
|
-
* ```
|
|
343
|
-
*/
|
|
344
|
-
function userCheckExists(options: FindUserEntity): Promise<unknown>;
|
|
345
|
-
}
|