cidaas-javascript-sdk 4.2.1 → 4.2.3
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 +12 -2
- package/README.md +2 -0
- package/dist/authentication/authentication.model.d.ts +1 -0
- package/dist/authentication/authentication.model.js +9 -36
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.js +27 -58
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -5
- package/dist/web-auth/ConsentService.js +10 -13
- package/dist/web-auth/Entities.js +20 -39
- package/dist/web-auth/Helper.js +12 -22
- package/dist/web-auth/JwtHelper.js +21 -28
- package/dist/web-auth/LoginService.d.ts +21 -0
- package/dist/web-auth/LoginService.js +46 -22
- package/dist/web-auth/TokenService.js +46 -85
- package/dist/web-auth/UserService.js +38 -41
- package/dist/web-auth/VerificationService.js +18 -21
- package/dist/web-auth/WebAuth.d.ts +10 -0
- package/dist/web-auth/WebAuth.js +274 -315
- package/package.json +1 -2
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.LoginService = void 0;
|
|
4
|
-
var Helper_1 = require("./Helper");
|
|
5
|
-
var LoginService;
|
|
1
|
+
import { Helper, CustomException } from "./Helper";
|
|
2
|
+
export var LoginService;
|
|
6
3
|
(function (LoginService) {
|
|
7
4
|
/**
|
|
8
5
|
* To login with your credentials, call **loginWithCredentials()**. After successful login, this will redirect you to the redirect_url that you mentioned earlier while initialising the sdk.
|
|
@@ -19,13 +16,13 @@ var LoginService;
|
|
|
19
16
|
*/
|
|
20
17
|
function loginWithCredentials(options) {
|
|
21
18
|
try {
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const url = window.webAuthSettings.authority + "/login-srv/login";
|
|
20
|
+
let form = Helper.createForm(url, options);
|
|
24
21
|
document.body.appendChild(form);
|
|
25
22
|
form.submit();
|
|
26
23
|
}
|
|
27
24
|
catch (ex) {
|
|
28
|
-
throw new
|
|
25
|
+
throw new CustomException(ex, 417);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
LoginService.loginWithCredentials = loginWithCredentials;
|
|
@@ -99,13 +96,13 @@ var LoginService;
|
|
|
99
96
|
*/
|
|
100
97
|
function passwordlessLogin(options) {
|
|
101
98
|
try {
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
const url = window.webAuthSettings.authority + "/login-srv/verification/login";
|
|
100
|
+
let form = Helper.createForm(url, options);
|
|
104
101
|
document.body.appendChild(form);
|
|
105
102
|
form.submit();
|
|
106
103
|
}
|
|
107
104
|
catch (ex) {
|
|
108
|
-
throw new
|
|
105
|
+
throw new CustomException(ex, 417);
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
LoginService.passwordlessLogin = passwordlessLogin;
|
|
@@ -125,13 +122,13 @@ var LoginService;
|
|
|
125
122
|
*/
|
|
126
123
|
function consentContinue(options) {
|
|
127
124
|
try {
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
126
|
+
let form = Helper.createForm(url, options);
|
|
130
127
|
document.body.appendChild(form);
|
|
131
128
|
form.submit();
|
|
132
129
|
}
|
|
133
130
|
catch (ex) {
|
|
134
|
-
throw new
|
|
131
|
+
throw new CustomException(ex, 417);
|
|
135
132
|
}
|
|
136
133
|
}
|
|
137
134
|
LoginService.consentContinue = consentContinue;
|
|
@@ -150,13 +147,13 @@ var LoginService;
|
|
|
150
147
|
*/
|
|
151
148
|
function mfaContinue(options) {
|
|
152
149
|
try {
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
151
|
+
let form = Helper.createForm(url, options);
|
|
155
152
|
document.body.appendChild(form);
|
|
156
153
|
form.submit();
|
|
157
154
|
}
|
|
158
155
|
catch (ex) {
|
|
159
|
-
throw new
|
|
156
|
+
throw new CustomException(ex, 417);
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
LoginService.mfaContinue = mfaContinue;
|
|
@@ -177,13 +174,13 @@ var LoginService;
|
|
|
177
174
|
*/
|
|
178
175
|
function firstTimeChangePassword(options) {
|
|
179
176
|
try {
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.loginSettingsId;
|
|
178
|
+
let form = Helper.createForm(url, options);
|
|
182
179
|
document.body.appendChild(form);
|
|
183
180
|
form.submit();
|
|
184
181
|
}
|
|
185
182
|
catch (ex) {
|
|
186
|
-
throw new
|
|
183
|
+
throw new CustomException(ex, 417);
|
|
187
184
|
}
|
|
188
185
|
}
|
|
189
186
|
LoginService.firstTimeChangePassword = firstTimeChangePassword;
|
|
@@ -212,8 +209,35 @@ var LoginService;
|
|
|
212
209
|
*/
|
|
213
210
|
function progressiveRegistration(options, headers) {
|
|
214
211
|
var serviceURL = window.webAuthSettings.authority + "/login-srv/progressive/update/user";
|
|
215
|
-
return
|
|
212
|
+
return Helper.createHttpPromise(options, serviceURL, undefined, "POST", undefined, headers);
|
|
216
213
|
}
|
|
217
214
|
LoginService.progressiveRegistration = progressiveRegistration;
|
|
218
215
|
;
|
|
219
|
-
|
|
216
|
+
/**
|
|
217
|
+
* To automatically do user login after successful registration, call **loginAfterRegister()**. Make sure to turn on "auto login after register" switch on the admin ui to activate loginAfterRegister flow.
|
|
218
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
|
|
219
|
+
* @example
|
|
220
|
+
* ```js
|
|
221
|
+
* cidaas.loginAfterRegister({
|
|
222
|
+
* device_id: 'your device id',
|
|
223
|
+
* dc: 'device capacity'
|
|
224
|
+
* rememberMe: false,
|
|
225
|
+
* trackId: 'your track id',
|
|
226
|
+
* device_fp: 'device fingerprint'
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
function loginAfterRegister(options) {
|
|
231
|
+
try {
|
|
232
|
+
const url = window.webAuthSettings.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
|
|
233
|
+
let form = Helper.createForm(url, options);
|
|
234
|
+
document.body.appendChild(form);
|
|
235
|
+
form.submit();
|
|
236
|
+
}
|
|
237
|
+
catch (ex) {
|
|
238
|
+
throw new CustomException(ex, 417);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
LoginService.loginAfterRegister = loginAfterRegister;
|
|
242
|
+
;
|
|
243
|
+
})(LoginService || (LoginService = {}));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,38 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.__esModule = true;
|
|
39
|
-
exports.TokenService = void 0;
|
|
40
|
-
var Helper_1 = require("./Helper");
|
|
41
|
-
var JwtHelper_1 = require("./JwtHelper");
|
|
42
|
-
var TokenService;
|
|
10
|
+
import { Helper, CustomException } from "./Helper";
|
|
11
|
+
import { JwtHelper } from "./JwtHelper";
|
|
12
|
+
export var TokenService;
|
|
43
13
|
(function (TokenService) {
|
|
44
14
|
/**
|
|
45
15
|
* To get a new token with the grant type refresh_token, call **renewToken()**.
|
|
@@ -61,12 +31,12 @@ var TokenService;
|
|
|
61
31
|
*/
|
|
62
32
|
function renewToken(options) {
|
|
63
33
|
if (!options.refresh_token) {
|
|
64
|
-
throw new
|
|
34
|
+
throw new CustomException("refresh_token cannot be empty", 417);
|
|
65
35
|
}
|
|
66
36
|
options.client_id = window.webAuthSettings.client_id;
|
|
67
37
|
options.grant_type = 'refresh_token';
|
|
68
|
-
|
|
69
|
-
return
|
|
38
|
+
const _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
39
|
+
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
70
40
|
}
|
|
71
41
|
TokenService.renewToken = renewToken;
|
|
72
42
|
;
|
|
@@ -90,28 +60,19 @@ var TokenService;
|
|
|
90
60
|
*/
|
|
91
61
|
function getAccessToken(options) {
|
|
92
62
|
var _a;
|
|
93
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
case 1:
|
|
107
|
-
signInRequest = _b.sent();
|
|
108
|
-
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
109
|
-
_b.label = 2;
|
|
110
|
-
case 2:
|
|
111
|
-
_serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
112
|
-
return [2 /*return*/, Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST")];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (!options.code) {
|
|
65
|
+
throw new CustomException("code cannot be empty", 417);
|
|
66
|
+
}
|
|
67
|
+
options.client_id = window.webAuthSettings.client_id;
|
|
68
|
+
options.redirect_uri = window.webAuthSettings.redirect_uri;
|
|
69
|
+
options.grant_type = "authorization_code";
|
|
70
|
+
if (!window.webAuthSettings.disablePKCE) {
|
|
71
|
+
var signInRequest = yield window.usermanager.getClient().createSigninRequest(window.webAuthSettings);
|
|
72
|
+
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
73
|
+
}
|
|
74
|
+
const _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
75
|
+
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
115
76
|
});
|
|
116
77
|
}
|
|
117
78
|
TokenService.getAccessToken = getAccessToken;
|
|
@@ -137,10 +98,10 @@ var TokenService;
|
|
|
137
98
|
*/
|
|
138
99
|
function validateAccessToken(options) {
|
|
139
100
|
if (!options.token || !options.token_type_hint) {
|
|
140
|
-
throw new
|
|
101
|
+
throw new CustomException("token or token_type_hint cannot be empty", 417);
|
|
141
102
|
}
|
|
142
|
-
|
|
143
|
-
return
|
|
103
|
+
const _serviceURL = window.webAuthSettings.authority + "/token-srv/introspect";
|
|
104
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST", options.token);
|
|
144
105
|
}
|
|
145
106
|
TokenService.validateAccessToken = validateAccessToken;
|
|
146
107
|
;
|
|
@@ -164,8 +125,8 @@ var TokenService;
|
|
|
164
125
|
* ```
|
|
165
126
|
*/
|
|
166
127
|
function loginPrecheck(options) {
|
|
167
|
-
|
|
168
|
-
return
|
|
128
|
+
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id + "?acceptLanguage=" + options.locale;
|
|
129
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
169
130
|
}
|
|
170
131
|
TokenService.loginPrecheck = loginPrecheck;
|
|
171
132
|
;
|
|
@@ -185,8 +146,8 @@ var TokenService;
|
|
|
185
146
|
* ```
|
|
186
147
|
*/
|
|
187
148
|
function getMissingFields(trackId) {
|
|
188
|
-
|
|
189
|
-
return
|
|
149
|
+
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
|
|
150
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
190
151
|
}
|
|
191
152
|
TokenService.getMissingFields = getMissingFields;
|
|
192
153
|
;
|
|
@@ -206,9 +167,9 @@ var TokenService;
|
|
|
206
167
|
* ```
|
|
207
168
|
*/
|
|
208
169
|
function initiateDeviceCode(clientId) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return
|
|
170
|
+
const clientid = clientId !== null && clientId !== void 0 ? clientId : window.webAuthSettings.client_id;
|
|
171
|
+
const _serviceURL = `${window.webAuthSettings.authority}/authz-srv/device/authz?client_id=${clientid}`;
|
|
172
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
212
173
|
}
|
|
213
174
|
TokenService.initiateDeviceCode = initiateDeviceCode;
|
|
214
175
|
/**
|
|
@@ -226,13 +187,13 @@ var TokenService;
|
|
|
226
187
|
* ```
|
|
227
188
|
*/
|
|
228
189
|
function deviceCodeVerify(code) {
|
|
229
|
-
var params =
|
|
230
|
-
var url =
|
|
190
|
+
var params = `user_code=${encodeURI(code)}`;
|
|
191
|
+
var url = `${window.webAuthSettings.authority}/token-srv/device/verify?${params}`;
|
|
231
192
|
try {
|
|
232
|
-
|
|
193
|
+
const options = {
|
|
233
194
|
user_code: encodeURI(code)
|
|
234
195
|
};
|
|
235
|
-
|
|
196
|
+
let form = Helper.createForm(url, options, 'GET');
|
|
236
197
|
document.body.appendChild(form);
|
|
237
198
|
form.submit();
|
|
238
199
|
}
|
|
@@ -250,36 +211,36 @@ var TokenService;
|
|
|
250
211
|
*/
|
|
251
212
|
function offlineTokenCheck(accessToken) {
|
|
252
213
|
var _a, _b;
|
|
253
|
-
|
|
214
|
+
let result = {
|
|
254
215
|
isExpiryDateValid: false,
|
|
255
216
|
isScopesValid: false,
|
|
256
|
-
isIssuerValid: false
|
|
217
|
+
isIssuerValid: false,
|
|
257
218
|
};
|
|
258
|
-
|
|
259
|
-
|
|
219
|
+
const accessTokenHeaderAsJson = JwtHelper.decodeTokenHeader(accessToken);
|
|
220
|
+
const accessTokenAsJson = JwtHelper.decodeToken(accessToken);
|
|
260
221
|
if (!accessTokenAsJson || !accessTokenHeaderAsJson) {
|
|
261
222
|
return result;
|
|
262
223
|
}
|
|
263
224
|
else {
|
|
264
225
|
if (accessTokenAsJson.exp) {
|
|
265
|
-
|
|
226
|
+
const expirationDate = new Date(0);
|
|
266
227
|
expirationDate.setUTCSeconds(accessTokenAsJson.exp);
|
|
267
228
|
result.isExpiryDateValid = expirationDate.valueOf() > new Date().valueOf();
|
|
268
229
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if ((
|
|
272
|
-
webAuthSettingScopes.forEach(
|
|
273
|
-
|
|
230
|
+
const accessTokenScopes = accessTokenAsJson.scopes;
|
|
231
|
+
const webAuthSettingScopes = (_b = (_a = window.webAuthSettings) === null || _a === void 0 ? void 0 : _a.scope) === null || _b === void 0 ? void 0 : _b.split(' ');
|
|
232
|
+
if ((accessTokenScopes === null || accessTokenScopes === void 0 ? void 0 : accessTokenScopes.length) === (webAuthSettingScopes === null || webAuthSettingScopes === void 0 ? void 0 : webAuthSettingScopes.length)) {
|
|
233
|
+
webAuthSettingScopes.forEach(webAuthSettingScope => {
|
|
234
|
+
const i = accessTokenScopes.indexOf(webAuthSettingScope);
|
|
274
235
|
if (i > -1) {
|
|
275
|
-
|
|
236
|
+
accessTokenScopes.splice(i, 1);
|
|
276
237
|
}
|
|
277
238
|
});
|
|
278
|
-
result.isScopesValid =
|
|
239
|
+
result.isScopesValid = accessTokenScopes.length === 0;
|
|
279
240
|
}
|
|
280
241
|
result.isIssuerValid = accessTokenAsJson.iss === window.webAuthSettings.authority;
|
|
281
242
|
}
|
|
282
243
|
return result;
|
|
283
244
|
}
|
|
284
245
|
TokenService.offlineTokenCheck = offlineTokenCheck;
|
|
285
|
-
})(TokenService
|
|
246
|
+
})(TokenService || (TokenService = {}));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.UserService = void 0;
|
|
4
|
-
var Helper_1 = require("./Helper");
|
|
5
|
-
var UserService;
|
|
1
|
+
import { Helper, CustomException } from "./Helper";
|
|
2
|
+
export var UserService;
|
|
6
3
|
(function (UserService) {
|
|
7
4
|
/**
|
|
8
5
|
* To get the user profile information by using cidaas internal api, call **getUserProfile()**.
|
|
@@ -22,10 +19,10 @@ var UserService;
|
|
|
22
19
|
*/
|
|
23
20
|
function getUserProfile(options) {
|
|
24
21
|
if (!options.access_token) {
|
|
25
|
-
throw new
|
|
22
|
+
throw new CustomException("access_token cannot be empty", 417);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
return
|
|
24
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo";
|
|
25
|
+
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", options.access_token);
|
|
29
26
|
}
|
|
30
27
|
UserService.getUserProfile = getUserProfile;
|
|
31
28
|
;
|
|
@@ -58,11 +55,11 @@ var UserService;
|
|
|
58
55
|
*```
|
|
59
56
|
*/
|
|
60
57
|
function register(options, headers) {
|
|
61
|
-
|
|
58
|
+
let _serviceURL = window.webAuthSettings.authority + "/users-srv/register";
|
|
62
59
|
if (options.invite_id) {
|
|
63
60
|
_serviceURL = _serviceURL + "?invite_id=" + options.invite_id;
|
|
64
61
|
}
|
|
65
|
-
return
|
|
62
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
66
63
|
}
|
|
67
64
|
UserService.register = register;
|
|
68
65
|
;
|
|
@@ -85,14 +82,14 @@ var UserService;
|
|
|
85
82
|
* ```
|
|
86
83
|
*/
|
|
87
84
|
function getInviteUserDetails(options) {
|
|
88
|
-
|
|
85
|
+
let _serviceURL = "";
|
|
89
86
|
if (options.callLatestAPI) {
|
|
90
87
|
_serviceURL = window.webAuthSettings.authority + "/useractions-srv/invitations/" + options.invite_id;
|
|
91
88
|
}
|
|
92
89
|
else {
|
|
93
90
|
_serviceURL = window.webAuthSettings.authority + "/users-srv/invite/info/" + options.invite_id;
|
|
94
91
|
}
|
|
95
|
-
return
|
|
92
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
96
93
|
}
|
|
97
94
|
UserService.getInviteUserDetails = getInviteUserDetails;
|
|
98
95
|
;
|
|
@@ -110,8 +107,8 @@ var UserService;
|
|
|
110
107
|
* ```
|
|
111
108
|
*/
|
|
112
109
|
function getCommunicationStatus(options, headers) {
|
|
113
|
-
|
|
114
|
-
return
|
|
110
|
+
let _serviceURL = window.webAuthSettings.authority + "/users-srv/user/communication/status/" + options.sub;
|
|
111
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
115
112
|
}
|
|
116
113
|
UserService.getCommunicationStatus = getCommunicationStatus;
|
|
117
114
|
;
|
|
@@ -134,7 +131,7 @@ var UserService;
|
|
|
134
131
|
*/
|
|
135
132
|
function initiateResetPassword(options) {
|
|
136
133
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/resetpassword/initiate";
|
|
137
|
-
return
|
|
134
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
138
135
|
}
|
|
139
136
|
UserService.initiateResetPassword = initiateResetPassword;
|
|
140
137
|
;
|
|
@@ -156,20 +153,20 @@ var UserService;
|
|
|
156
153
|
*/
|
|
157
154
|
function handleResetPassword(options, handleResponseAsJson) {
|
|
158
155
|
try {
|
|
159
|
-
|
|
156
|
+
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/validatecode";
|
|
160
157
|
if (!handleResponseAsJson) {
|
|
161
158
|
// current handling will redirect and give query parameters
|
|
162
|
-
|
|
159
|
+
let form = Helper.createForm(url, options);
|
|
163
160
|
document.body.appendChild(form);
|
|
164
161
|
form.submit();
|
|
165
162
|
}
|
|
166
163
|
else {
|
|
167
164
|
// older cidaas service handling return json object
|
|
168
|
-
return
|
|
165
|
+
return Helper.createHttpPromise(options, url, false, "POST");
|
|
169
166
|
}
|
|
170
167
|
}
|
|
171
168
|
catch (ex) {
|
|
172
|
-
throw new
|
|
169
|
+
throw new CustomException(ex, 417);
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
172
|
UserService.handleResetPassword = handleResetPassword;
|
|
@@ -193,21 +190,21 @@ var UserService;
|
|
|
193
190
|
* ```
|
|
194
191
|
*/
|
|
195
192
|
function resetPassword(options, handleResponseAsJson) {
|
|
196
|
-
|
|
193
|
+
const url = window.webAuthSettings.authority + "/users-srv/resetpassword/accept";
|
|
197
194
|
try {
|
|
198
195
|
if (!handleResponseAsJson) {
|
|
199
196
|
// current handling will redirect and give query parameters
|
|
200
|
-
|
|
197
|
+
let form = Helper.createForm(url, options);
|
|
201
198
|
document.body.appendChild(form);
|
|
202
199
|
form.submit();
|
|
203
200
|
}
|
|
204
201
|
else {
|
|
205
202
|
// older cidaas service handling return json object
|
|
206
|
-
return
|
|
203
|
+
return Helper.createHttpPromise(options, url, false, "POST");
|
|
207
204
|
}
|
|
208
205
|
}
|
|
209
206
|
catch (ex) {
|
|
210
|
-
throw new
|
|
207
|
+
throw new CustomException(ex, 417);
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
210
|
UserService.resetPassword = resetPassword;
|
|
@@ -226,8 +223,8 @@ var UserService;
|
|
|
226
223
|
* ```
|
|
227
224
|
*/
|
|
228
225
|
function getDeduplicationDetails(options) {
|
|
229
|
-
|
|
230
|
-
return
|
|
226
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/info/" + options.trackId;
|
|
227
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "GET");
|
|
231
228
|
}
|
|
232
229
|
UserService.getDeduplicationDetails = getDeduplicationDetails;
|
|
233
230
|
;
|
|
@@ -244,13 +241,13 @@ var UserService;
|
|
|
244
241
|
*/
|
|
245
242
|
function deduplicationLogin(options) {
|
|
246
243
|
try {
|
|
247
|
-
|
|
248
|
-
|
|
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, {});
|
|
249
246
|
document.body.appendChild(form);
|
|
250
247
|
form.submit();
|
|
251
248
|
}
|
|
252
249
|
catch (ex) {
|
|
253
|
-
throw new
|
|
250
|
+
throw new CustomException(ex, 417);
|
|
254
251
|
}
|
|
255
252
|
}
|
|
256
253
|
UserService.deduplicationLogin = deduplicationLogin;
|
|
@@ -269,8 +266,8 @@ var UserService;
|
|
|
269
266
|
* ```
|
|
270
267
|
*/
|
|
271
268
|
function registerDeduplication(options) {
|
|
272
|
-
|
|
273
|
-
return
|
|
269
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/deduplication/register/" + options.trackId;
|
|
270
|
+
return Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST");
|
|
274
271
|
}
|
|
275
272
|
UserService.registerDeduplication = registerDeduplication;
|
|
276
273
|
;
|
|
@@ -294,7 +291,7 @@ var UserService;
|
|
|
294
291
|
*/
|
|
295
292
|
function changePassword(options, access_token) {
|
|
296
293
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/changepassword";
|
|
297
|
-
return
|
|
294
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
298
295
|
}
|
|
299
296
|
UserService.changePassword = changePassword;
|
|
300
297
|
;
|
|
@@ -316,8 +313,8 @@ var UserService;
|
|
|
316
313
|
* ```
|
|
317
314
|
*/
|
|
318
315
|
function updateProfile(options, access_token, sub) {
|
|
319
|
-
|
|
320
|
-
return
|
|
316
|
+
const _serviceURL = window.webAuthSettings.authority + "/users-srv/user/profile/" + sub;
|
|
317
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "PUT", access_token);
|
|
321
318
|
}
|
|
322
319
|
UserService.updateProfile = updateProfile;
|
|
323
320
|
;
|
|
@@ -341,7 +338,7 @@ var UserService;
|
|
|
341
338
|
function initiateLinkAccount(options, access_token) {
|
|
342
339
|
options.user_name_type = 'email';
|
|
343
340
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/initiate";
|
|
344
|
-
return
|
|
341
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
345
342
|
}
|
|
346
343
|
UserService.initiateLinkAccount = initiateLinkAccount;
|
|
347
344
|
;
|
|
@@ -363,7 +360,7 @@ var UserService;
|
|
|
363
360
|
*/
|
|
364
361
|
function completeLinkAccount(options, access_token) {
|
|
365
362
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/link/complete";
|
|
366
|
-
return
|
|
363
|
+
return Helper.createHttpPromise(options, _serviceURL, false, "POST", access_token);
|
|
367
364
|
}
|
|
368
365
|
UserService.completeLinkAccount = completeLinkAccount;
|
|
369
366
|
;
|
|
@@ -385,7 +382,7 @@ var UserService;
|
|
|
385
382
|
*/
|
|
386
383
|
function getLinkedUsers(access_token, sub) {
|
|
387
384
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/userinfo/social/" + sub;
|
|
388
|
-
return
|
|
385
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "GET", access_token);
|
|
389
386
|
}
|
|
390
387
|
UserService.getLinkedUsers = getLinkedUsers;
|
|
391
388
|
;
|
|
@@ -407,7 +404,7 @@ var UserService;
|
|
|
407
404
|
*/
|
|
408
405
|
function unlinkAccount(access_token, identityId) {
|
|
409
406
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unlink/" + identityId;
|
|
410
|
-
return
|
|
407
|
+
return Helper.createHttpPromise(undefined, _serviceURL, false, "POST", access_token);
|
|
411
408
|
}
|
|
412
409
|
UserService.unlinkAccount = unlinkAccount;
|
|
413
410
|
;
|
|
@@ -430,7 +427,7 @@ var UserService;
|
|
|
430
427
|
*/
|
|
431
428
|
function deleteUserAccount(options) {
|
|
432
429
|
var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/unregister/scheduler/schedule/" + options.sub;
|
|
433
|
-
return
|
|
430
|
+
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST", options.access_token);
|
|
434
431
|
}
|
|
435
432
|
UserService.deleteUserAccount = deleteUserAccount;
|
|
436
433
|
;
|
|
@@ -450,7 +447,7 @@ var UserService;
|
|
|
450
447
|
* ```
|
|
451
448
|
*/
|
|
452
449
|
function userCheckExists(options) {
|
|
453
|
-
|
|
450
|
+
let queryParameter = '';
|
|
454
451
|
if (options.webfinger || options.rememberMe) {
|
|
455
452
|
queryParameter += '?';
|
|
456
453
|
if (options.webfinger) {
|
|
@@ -464,8 +461,8 @@ var UserService;
|
|
|
464
461
|
}
|
|
465
462
|
}
|
|
466
463
|
var _serviceURL = window.webAuthSettings.authority + "/useractions-srv/userexistence/" + options.requestId + queryParameter;
|
|
467
|
-
return
|
|
464
|
+
return Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
468
465
|
}
|
|
469
466
|
UserService.userCheckExists = userCheckExists;
|
|
470
467
|
;
|
|
471
|
-
})(UserService
|
|
468
|
+
})(UserService || (UserService = {}));
|