cidaas-javascript-sdk 4.3.3 → 5.1.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 +40 -4
- package/README.md +156 -94
- package/dist/authentication-service/AuthenticationService.d.ts +140 -0
- package/dist/authentication-service/AuthenticationService.js +210 -0
- package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
- package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
- package/dist/common/Common.model.d.ts +15 -19
- package/dist/common/Common.model.js +17 -17
- package/dist/common/ConfigUserProvider.d.ts +10 -0
- package/dist/common/ConfigUserProvider.js +28 -0
- package/dist/common/Helper.d.ts +7 -0
- package/dist/common/Helper.js +19 -0
- package/dist/common/User.model.d.ts +0 -4
- package/dist/consent-service/ConsentService.d.ts +99 -95
- package/dist/consent-service/ConsentService.js +125 -122
- package/dist/consent-service/ConsentService.model.d.ts +14 -16
- package/dist/device-service/DeviceService.d.ts +49 -0
- package/dist/device-service/DeviceService.js +79 -0
- package/dist/device-service/DeviceService.model.d.ts +6 -0
- package/dist/id-validation-service/IdValidationService.d.ts +28 -0
- package/dist/id-validation-service/IdValidationService.js +59 -0
- package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
- package/dist/id-validation-service/IdValidationService.model.js +2 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +35 -18
- package/dist/login-service/LoginService.d.ts +143 -141
- package/dist/login-service/LoginService.js +255 -232
- package/dist/login-service/LoginService.model.d.ts +9 -51
- package/dist/login-service/LoginService.model.js +1 -1
- package/dist/public-service/PublicService.d.ts +57 -0
- package/dist/public-service/PublicService.js +73 -0
- package/dist/public-service/PublicService.model.d.ts +20 -0
- package/dist/public-service/PublicService.model.js +2 -0
- package/dist/token-service/TokenService.d.ts +104 -138
- package/dist/token-service/TokenService.js +164 -219
- package/dist/token-service/TokenService.model.d.ts +3 -44
- package/dist/token-service/TokenService.model.js +3 -16
- package/dist/user-service/UserService.d.ts +381 -315
- package/dist/user-service/UserService.js +552 -426
- package/dist/user-service/UserService.model.d.ts +48 -14
- package/dist/user-service/UserService.model.js +4 -4
- package/dist/verification-service/VerificationService.d.ts +281 -223
- package/dist/verification-service/VerificationService.js +343 -287
- package/dist/verification-service/VerificationService.model.d.ts +4 -5
- package/package.json +6 -4
- package/dist/authentication/Authentication.d.ts +0 -139
- package/dist/authentication/Authentication.js +0 -186
- package/dist/web-auth/WebAuth.d.ts +0 -665
- package/dist/web-auth/WebAuth.js +0 -955
- package/dist/web-auth/webauth.model.d.ts +0 -66
- /package/dist/{web-auth/webauth.model.js → device-service/DeviceService.model.js} +0 -0
|
@@ -1,247 +1,270 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LoginService = void 0;
|
|
4
4
|
const Helper_1 = require("../common/Helper");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @example
|
|
9
|
-
* ```js
|
|
10
|
-
* cidaas.loginWithCredentials({
|
|
11
|
-
* username: 'xxxx@gmail.com',
|
|
12
|
-
* username_type: 'email',
|
|
13
|
-
* password: '123456',
|
|
14
|
-
* requestId: 'your requestId',
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function loginWithCredentials(options) {
|
|
19
|
-
try {
|
|
20
|
-
const url = window.webAuthSettings.authority + "/login-srv/login";
|
|
21
|
-
const form = Helper_1.Helper.createForm(url, options);
|
|
22
|
-
document.body.appendChild(form);
|
|
23
|
-
form.submit();
|
|
5
|
+
class LoginService {
|
|
6
|
+
constructor(configUserProvider) {
|
|
7
|
+
this.config = configUserProvider.getConfig();
|
|
24
8
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
catch (ex) {
|
|
50
|
-
console.log(ex);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.loginWithSocial = loginWithSocial;
|
|
54
|
-
/**
|
|
55
|
-
* To register with social providers, call **registerWithSocial()**. This will redirect you to the facebook login page.
|
|
56
|
-
* @example
|
|
57
|
-
* Note: giving the queryParams is not required.
|
|
58
|
-
* ```js
|
|
59
|
-
* queryParams = {
|
|
60
|
-
* dc: 'dc',
|
|
61
|
-
* device_fp: 'device_fp'
|
|
62
|
-
* }
|
|
63
|
-
* cidaas.registerWithSocial({
|
|
64
|
-
* provider: 'facebook',
|
|
65
|
-
* requestId: 'your requestId',
|
|
66
|
-
* }, queryParams);
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
function registerWithSocial(options, queryParams) {
|
|
70
|
-
try {
|
|
71
|
-
let _serviceURL = window.webAuthSettings.authority + "/login-srv/social/register/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
72
|
-
if (queryParams && queryParams.dc && queryParams.device_fp) {
|
|
73
|
-
_serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
|
|
74
|
-
}
|
|
75
|
-
window.location.href = _serviceURL;
|
|
76
|
-
}
|
|
77
|
-
catch (ex) {
|
|
78
|
-
console.log(ex);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.registerWithSocial = registerWithSocial;
|
|
82
|
-
/**
|
|
83
|
-
* To authenticate without using password, call **passwordlessLogin()**.
|
|
84
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/k1lwsraxk0rjc-login-passwordless-request for more details.
|
|
85
|
-
* @example
|
|
86
|
-
* ```js
|
|
87
|
-
* cidaas.passwordlessLogin({
|
|
88
|
-
* requestId: 'your requestId',
|
|
89
|
-
* sub: 'your user sub',
|
|
90
|
-
* statusId: 'status id from authenticateMFA()'
|
|
91
|
-
* verificationType: 'your verificationType. e.g. VerificationType.EMAIL'
|
|
92
|
-
* });
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
function passwordlessLogin(options) {
|
|
96
|
-
try {
|
|
97
|
-
const url = window.webAuthSettings.authority + "/login-srv/verification/login";
|
|
98
|
-
const form = Helper_1.Helper.createForm(url, options);
|
|
99
|
-
document.body.appendChild(form);
|
|
100
|
-
form.submit();
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
11
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/5gphdk6vapp56-classic-login#call-login-api for more details.
|
|
12
|
+
* @example
|
|
13
|
+
* ```js
|
|
14
|
+
* cidaasLoginService.loginWithCredentials({
|
|
15
|
+
* username: 'xxxx@gmail.com',
|
|
16
|
+
* username_type: 'email',
|
|
17
|
+
* password: '123456',
|
|
18
|
+
* requestId: 'your requestId',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
loginWithCredentials(options) {
|
|
23
|
+
try {
|
|
24
|
+
const url = this.config.authority + "/login-srv/login";
|
|
25
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
26
|
+
document.body.appendChild(form);
|
|
27
|
+
form.submit();
|
|
28
|
+
}
|
|
29
|
+
catch (ex) {
|
|
30
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
31
|
+
}
|
|
101
32
|
}
|
|
102
|
-
|
|
103
|
-
|
|
33
|
+
/**
|
|
34
|
+
* To login with social providers, call **loginWithSocial()**. This will redirect you to the facebook login page.
|
|
35
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9mi5uqxhqlsm5-social-login#call-social-login-api for more details
|
|
36
|
+
* @example
|
|
37
|
+
* ```js
|
|
38
|
+
* cidaasLoginService.loginWithSocial({
|
|
39
|
+
* provider: 'facebook',
|
|
40
|
+
* requestId: 'your requestId',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
loginWithSocial(options, queryParams) {
|
|
45
|
+
if (!options.provider || !options.requestId) {
|
|
46
|
+
throw new Helper_1.CustomException("provider and requestId cannot be empty", 417);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
let _serviceURL = this.config.authority + "/login-srv/social/login/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
50
|
+
if (queryParams) {
|
|
51
|
+
const params = new URLSearchParams();
|
|
52
|
+
Object.keys(queryParams).forEach(key => {
|
|
53
|
+
const value = queryParams[key];
|
|
54
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
55
|
+
params.append(key, value);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const queryString = params.toString();
|
|
59
|
+
if (queryString) {
|
|
60
|
+
_serviceURL = _serviceURL + "?" + queryString;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
window.location.href = _serviceURL;
|
|
64
|
+
}
|
|
65
|
+
catch (ex) {
|
|
66
|
+
if (ex instanceof Helper_1.CustomException) {
|
|
67
|
+
throw ex;
|
|
68
|
+
}
|
|
69
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
70
|
+
}
|
|
104
71
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* }
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
72
|
+
/**
|
|
73
|
+
* To register with social providers, call **registerWithSocial()**. This will redirect you to the facebook login page.
|
|
74
|
+
* @example
|
|
75
|
+
* Note: giving the queryParams is not required.
|
|
76
|
+
* ```js
|
|
77
|
+
* queryParams = {
|
|
78
|
+
* dc: 'dc',
|
|
79
|
+
* device_fp: 'device_fp'
|
|
80
|
+
* }
|
|
81
|
+
* cidaasLoginService.registerWithSocial({
|
|
82
|
+
* provider: 'facebook',
|
|
83
|
+
* requestId: 'your requestId',
|
|
84
|
+
* }, queryParams);
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
registerWithSocial(options, queryParams) {
|
|
88
|
+
if (!options.provider || !options.requestId) {
|
|
89
|
+
throw new Helper_1.CustomException("provider and requestId cannot be empty", 417);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
let _serviceURL = this.config.authority + "/login-srv/social/register/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
93
|
+
if (queryParams) {
|
|
94
|
+
const params = new URLSearchParams();
|
|
95
|
+
Object.keys(queryParams).forEach(key => {
|
|
96
|
+
const value = queryParams[key];
|
|
97
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
98
|
+
params.append(key, value);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const queryString = params.toString();
|
|
102
|
+
if (queryString) {
|
|
103
|
+
_serviceURL = _serviceURL + "?" + queryString;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
window.location.href = _serviceURL;
|
|
107
|
+
}
|
|
108
|
+
catch (ex) {
|
|
109
|
+
if (ex instanceof Helper_1.CustomException) {
|
|
110
|
+
throw ex;
|
|
111
|
+
}
|
|
112
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
113
|
+
}
|
|
122
114
|
}
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
/**
|
|
116
|
+
* To authenticate without using password, call **passwordlessLogin()**.
|
|
117
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/k1lwsraxk0rjc-login-passwordless-request for more details.
|
|
118
|
+
* @example
|
|
119
|
+
* ```js
|
|
120
|
+
* cidaasLoginService.passwordlessLogin({
|
|
121
|
+
* requestId: 'your requestId',
|
|
122
|
+
* sub: 'your user sub',
|
|
123
|
+
* statusId: 'status id from authenticateMFA()'
|
|
124
|
+
* verificationType: 'your verificationType. e.g. VerificationType.Email'
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
passwordlessLogin(options) {
|
|
129
|
+
try {
|
|
130
|
+
const url = this.config.authority + "/login-srv/verification/login";
|
|
131
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
132
|
+
document.body.appendChild(form);
|
|
133
|
+
form.submit();
|
|
134
|
+
}
|
|
135
|
+
catch (ex) {
|
|
136
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
137
|
+
}
|
|
125
138
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
/**
|
|
140
|
+
* To continue after Consent acceptance, call **consentContinue()**.
|
|
141
|
+
* @example
|
|
142
|
+
* ```js
|
|
143
|
+
* cidaasLoginService.consentContinue({
|
|
144
|
+
* track_id: 'your track id'
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
consentContinue(options) {
|
|
149
|
+
try {
|
|
150
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
151
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
152
|
+
document.body.appendChild(form);
|
|
153
|
+
form.submit();
|
|
154
|
+
}
|
|
155
|
+
catch (ex) {
|
|
156
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
157
|
+
}
|
|
145
158
|
}
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
/**
|
|
160
|
+
* To continue after MFA completion, call **mfaContinue()**.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```js
|
|
164
|
+
* cidaasLoginService.mfaContinue({
|
|
165
|
+
* track_id: 'your track id'
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
mfaContinue(options) {
|
|
170
|
+
try {
|
|
171
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
172
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
173
|
+
document.body.appendChild(form);
|
|
174
|
+
form.submit();
|
|
175
|
+
}
|
|
176
|
+
catch (ex) {
|
|
177
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
178
|
+
}
|
|
148
179
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
document.body.appendChild(form);
|
|
172
|
-
form.submit();
|
|
180
|
+
/**
|
|
181
|
+
* to handle changing password by first login attempt after registration, call **firstTimeChangePassword()**.
|
|
182
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/fd8f478d96f58-continue-authentication-flow-after-prechecks for more details.
|
|
183
|
+
* @example
|
|
184
|
+
* ```js
|
|
185
|
+
* cidaasLoginService.firstTimeChangePassword({
|
|
186
|
+
* old_password: 'your old password',
|
|
187
|
+
* new_password: 'your new password',
|
|
188
|
+
* confirm_password: 'your new password'
|
|
189
|
+
* }, 'your track id');
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
firstTimeChangePassword(options, trackId) {
|
|
193
|
+
try {
|
|
194
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + trackId;
|
|
195
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
196
|
+
document.body.appendChild(form);
|
|
197
|
+
form.submit();
|
|
198
|
+
}
|
|
199
|
+
catch (ex) {
|
|
200
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
201
|
+
}
|
|
173
202
|
}
|
|
174
|
-
|
|
175
|
-
|
|
203
|
+
/**
|
|
204
|
+
* For progressive registration, call **progressiveRegistration()**. While logging in If the API returns 417 with the error message MissingRequiredFields, call the **getMissingFields** to get the list of missing fileds and proceed with progressive registration. In the sample request only the required fields are added, however you must provide the missing fields along with the required fields.
|
|
205
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/l7sknp2pytryr-progressive-registration for more details.
|
|
206
|
+
* @example
|
|
207
|
+
* ```js
|
|
208
|
+
* const options = {
|
|
209
|
+
* sub: 'your sub',
|
|
210
|
+
* }
|
|
211
|
+
* const headers = {
|
|
212
|
+
* trackId: 'the track id received while logging in',
|
|
213
|
+
* requestId: 'request id of the session',
|
|
214
|
+
* acceptlanguage: 'your locale/browser locale (OPTIONAL)',
|
|
215
|
+
* }
|
|
216
|
+
* cidaasLoginService.progressiveRegistration(options, headers)
|
|
217
|
+
* .then(function(response) {
|
|
218
|
+
* // type your code here
|
|
219
|
+
* })
|
|
220
|
+
* .catch(function (ex) {
|
|
221
|
+
* // your failure code here
|
|
222
|
+
* });
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
progressiveRegistration(options, headers) {
|
|
226
|
+
const serviceURL = this.config.authority + "/login-srv/progressive/update/user";
|
|
227
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, "POST", undefined, headers);
|
|
176
228
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
function progressiveRegistration(options, headers) {
|
|
202
|
-
const serviceURL = window.webAuthSettings.authority + "/login-srv/progressive/update/user";
|
|
203
|
-
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, "POST", undefined, headers);
|
|
204
|
-
}
|
|
205
|
-
exports.progressiveRegistration = progressiveRegistration;
|
|
206
|
-
/**
|
|
207
|
-
* 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.
|
|
208
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
|
|
209
|
-
* @example
|
|
210
|
-
* ```js
|
|
211
|
-
* cidaas.loginAfterRegister({
|
|
212
|
-
* device_id: 'your device id',
|
|
213
|
-
* dc: 'device capacity'
|
|
214
|
-
* rememberMe: false,
|
|
215
|
-
* trackId: 'your track id',
|
|
216
|
-
* device_fp: 'device fingerprint'
|
|
217
|
-
* });
|
|
218
|
-
* ```
|
|
219
|
-
*/
|
|
220
|
-
function loginAfterRegister(options) {
|
|
221
|
-
try {
|
|
222
|
-
const url = window.webAuthSettings.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
|
|
223
|
-
const form = Helper_1.Helper.createForm(url, options);
|
|
224
|
-
document.body.appendChild(form);
|
|
225
|
-
form.submit();
|
|
229
|
+
/**
|
|
230
|
+
* 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.
|
|
231
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
|
|
232
|
+
* @example
|
|
233
|
+
* ```js
|
|
234
|
+
* cidaasLoginService.loginAfterRegister({
|
|
235
|
+
* device_id: 'your device id',
|
|
236
|
+
* dc: 'device capacity'
|
|
237
|
+
* rememberMe: false,
|
|
238
|
+
* trackId: 'your track id',
|
|
239
|
+
* device_fp: 'device fingerprint'
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
loginAfterRegister(options) {
|
|
244
|
+
try {
|
|
245
|
+
const url = this.config.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
|
|
246
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
247
|
+
document.body.appendChild(form);
|
|
248
|
+
form.submit();
|
|
249
|
+
}
|
|
250
|
+
catch (ex) {
|
|
251
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
252
|
+
}
|
|
226
253
|
}
|
|
227
|
-
|
|
228
|
-
|
|
254
|
+
/**
|
|
255
|
+
* To do guest login after activating the feature from admin ui, call **actionGuestLogin()**
|
|
256
|
+
* Please refer to https://docs.cidaas.com/docs/cidaas-iam/95fd8492a64fe-guest-login for more details
|
|
257
|
+
* @example
|
|
258
|
+
* ```js
|
|
259
|
+
* cidaasLoginService.actionGuestLogin('your request id');
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
actionGuestLogin(requestId) {
|
|
263
|
+
const url = this.config.authority + '/login-srv/login/guest/' + requestId;
|
|
264
|
+
const loginFormElement = document.getElementsByName('guestLoginForm')[0];
|
|
265
|
+
loginFormElement.action = url;
|
|
266
|
+
loginFormElement.method = 'post';
|
|
267
|
+
loginFormElement.submit();
|
|
229
268
|
}
|
|
230
269
|
}
|
|
231
|
-
exports.
|
|
232
|
-
/**
|
|
233
|
-
* To do guest login after activating the feature from admin ui, call **actionGuestLogin()**
|
|
234
|
-
* Please refer to https://docs.cidaas.com/docs/cidaas-iam/95fd8492a64fe-guest-login for more details
|
|
235
|
-
* @example
|
|
236
|
-
* ```js
|
|
237
|
-
* cidaas.actionGuestLogin('your request id');
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
|
-
function actionGuestLogin(requestId) {
|
|
241
|
-
const url = window.webAuthSettings.authority + '/login-srv/login/guest/' + requestId;
|
|
242
|
-
const loginFormElement = document.getElementsByName('guestLoginForm')[0];
|
|
243
|
-
loginFormElement.action = url;
|
|
244
|
-
loginFormElement.method = 'post';
|
|
245
|
-
loginFormElement.submit();
|
|
246
|
-
}
|
|
247
|
-
exports.actionGuestLogin = actionGuestLogin;
|
|
270
|
+
exports.LoginService = LoginService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VerificationType } from "../common/Common.model";
|
|
2
2
|
export interface LoginWithCredentialsRequest {
|
|
3
3
|
/** User identifier used to login e.g. username, email or mobile number */
|
|
4
4
|
username: string;
|
|
@@ -8,19 +8,12 @@ export interface LoginWithCredentialsRequest {
|
|
|
8
8
|
requestId: string;
|
|
9
9
|
/**
|
|
10
10
|
* Type of username used in login
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
username_type?: UsernameType | string;
|
|
11
|
+
*/
|
|
12
|
+
username_type?: UsernameType;
|
|
14
13
|
/** Field identifier to tell service, where to look for in case of custom username type */
|
|
15
14
|
field_key?: string;
|
|
16
15
|
/** Login provider configured in cidaas admin ui */
|
|
17
16
|
provider?: string;
|
|
18
|
-
/** DEPRECATED: Captcha string for captcha check */
|
|
19
|
-
captcha?: string;
|
|
20
|
-
/** DEPRECATED: Needed in case bot captcha check is activated */
|
|
21
|
-
bot_captcha_response?: string;
|
|
22
|
-
/** DEPRECATED: Token for validating csrf */
|
|
23
|
-
csrf_token?: string;
|
|
24
17
|
/** Device capacity */
|
|
25
18
|
dc?: string;
|
|
26
19
|
/** Device finger print */
|
|
@@ -29,8 +22,6 @@ export interface LoginWithCredentialsRequest {
|
|
|
29
22
|
captcha_ref?: string;
|
|
30
23
|
/** Response language, which is configured in cidaas admin ui */
|
|
31
24
|
locale?: string;
|
|
32
|
-
/** DEPRECATED: Duplicate parameter, will be removed in next major release version */
|
|
33
|
-
rememberMe?: boolean;
|
|
34
25
|
/** Remember me flag to keep user signed in */
|
|
35
26
|
remember_me?: boolean;
|
|
36
27
|
}
|
|
@@ -54,6 +45,8 @@ export interface SocialProviderQueryParameter {
|
|
|
54
45
|
dc?: string;
|
|
55
46
|
/** Device finger print */
|
|
56
47
|
device_fp?: string;
|
|
48
|
+
/** Additional custom query parameters */
|
|
49
|
+
[key: string]: string | undefined;
|
|
57
50
|
}
|
|
58
51
|
export interface PasswordlessLoginRequest {
|
|
59
52
|
/** Request id returned from the authorization call */
|
|
@@ -62,59 +55,26 @@ export interface PasswordlessLoginRequest {
|
|
|
62
55
|
status_id: string;
|
|
63
56
|
/**
|
|
64
57
|
* Type of verification to be used to authenticate user
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
verificationType: VerificationType | string;
|
|
58
|
+
*/
|
|
59
|
+
verificationType: VerificationType;
|
|
68
60
|
/**
|
|
69
61
|
* Masked sub (id of user)
|
|
70
62
|
* Either sub or q have to be provided, depends on what is given from the query parameter.
|
|
71
|
-
|
|
63
|
+
*/
|
|
72
64
|
sub?: string;
|
|
73
65
|
/**
|
|
74
66
|
* Masked sub (id of user)
|
|
75
67
|
* Either sub or q have to be provided, depends on what is given from the query parameter.
|
|
76
|
-
|
|
77
|
-
q?: string;
|
|
78
|
-
}
|
|
79
|
-
/** DEPRECATED: MfaContinue should only need LoginPrecheckRequest. The change will be implemented in the next major version */
|
|
80
|
-
export interface MfaContinueRequest extends LoginPrecheckRequest {
|
|
68
|
+
*/
|
|
81
69
|
q?: string;
|
|
82
|
-
sub?: string;
|
|
83
|
-
requestId?: string;
|
|
84
|
-
status_id?: string;
|
|
85
|
-
verificationType?: string;
|
|
86
|
-
deviceInfo?: DeviceInfo;
|
|
87
|
-
device_fp?: string;
|
|
88
|
-
}
|
|
89
|
-
/** DEPRECATED: DeviceInfo is only used in MfaContinueRequest, which will be removed in the next major version */
|
|
90
|
-
export interface DeviceInfo {
|
|
91
|
-
userAgent?: string;
|
|
92
|
-
ipAddress?: string;
|
|
93
|
-
lat?: string;
|
|
94
|
-
lon?: string;
|
|
95
|
-
deviceId?: string;
|
|
96
|
-
usedTime?: Date;
|
|
97
|
-
purpose?: string;
|
|
98
|
-
requestId?: string;
|
|
99
|
-
sub?: string;
|
|
100
|
-
pushNotificationId?: string;
|
|
101
|
-
deviceMake?: string;
|
|
102
|
-
deviceModel?: string;
|
|
103
|
-
deviceType?: string;
|
|
104
70
|
}
|
|
105
71
|
export interface FirstTimeChangePasswordRequest {
|
|
106
|
-
/** Id of "force change password setting" returned from the login call, which redirect to change password page */
|
|
107
|
-
loginSettingsId: string;
|
|
108
72
|
/** Old password to be changed */
|
|
109
73
|
old_password: string;
|
|
110
74
|
/** New password to replaced old password */
|
|
111
75
|
new_password: string;
|
|
112
76
|
/** Needed to confirm new password */
|
|
113
77
|
confirm_password: string;
|
|
114
|
-
sub?: string;
|
|
115
|
-
identityId?: string;
|
|
116
|
-
accessToken?: string;
|
|
117
|
-
client_id?: string;
|
|
118
78
|
}
|
|
119
79
|
export interface ProgressiveRegistrationHeader {
|
|
120
80
|
/** Request id returned from the authorization call */
|
|
@@ -129,8 +89,6 @@ export interface ProgressiveRegistrationHeader {
|
|
|
129
89
|
lon?: string;
|
|
130
90
|
}
|
|
131
91
|
export interface LoginAfterRegisterRequest {
|
|
132
|
-
/** Deprecated: will be removed in the next major release */
|
|
133
|
-
device_id?: string;
|
|
134
92
|
/** Device capacity */
|
|
135
93
|
dc?: string;
|
|
136
94
|
/** If true, will keep user logged in */
|
|
@@ -10,4 +10,4 @@ var UsernameType;
|
|
|
10
10
|
UsernameType["Sub"] = "sub";
|
|
11
11
|
UsernameType["IdentityId"] = "identityid";
|
|
12
12
|
UsernameType["Custom"] = "custom";
|
|
13
|
-
})(UsernameType
|
|
13
|
+
})(UsernameType || (exports.UsernameType = UsernameType = {}));
|