cidaas-javascript-sdk 4.3.3 → 5.0.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 +52 -5
- package/README.md +109 -93
- 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 +225 -234
- package/dist/login-service/LoginService.model.d.ts +7 -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,238 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9mi5uqxhqlsm5-social-login#call-social-login-api for more details
|
|
33
|
-
* @example
|
|
34
|
-
* ```js
|
|
35
|
-
* cidaas.loginWithSocial({
|
|
36
|
-
* provider: 'facebook',
|
|
37
|
-
* requestId: 'your requestId',
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
function loginWithSocial(options, queryParams) {
|
|
42
|
-
try {
|
|
43
|
-
let _serviceURL = window.webAuthSettings.authority + "/login-srv/social/login/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
44
|
-
if (queryParams && queryParams.dc && queryParams.device_fp) {
|
|
45
|
-
_serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
|
|
46
|
-
}
|
|
47
|
-
window.location.href = _serviceURL;
|
|
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();
|
|
101
|
-
}
|
|
102
|
-
catch (ex) {
|
|
103
|
-
throw new Helper_1.CustomException(String(ex), 417);
|
|
5
|
+
class LoginService {
|
|
6
|
+
constructor(configUserProvider) {
|
|
7
|
+
this.config = configUserProvider.getConfig();
|
|
8
|
+
}
|
|
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
|
+
}
|
|
104
32
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* });
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
try {
|
|
46
|
+
let _serviceURL = this.config.authority + "/login-srv/social/login/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
47
|
+
if (queryParams && queryParams.dc && queryParams.device_fp) {
|
|
48
|
+
_serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
|
|
49
|
+
}
|
|
50
|
+
window.location.href = _serviceURL;
|
|
51
|
+
}
|
|
52
|
+
catch (ex) {
|
|
53
|
+
console.log(ex);
|
|
54
|
+
}
|
|
122
55
|
}
|
|
123
|
-
|
|
124
|
-
|
|
56
|
+
/**
|
|
57
|
+
* To register with social providers, call **registerWithSocial()**. This will redirect you to the facebook login page.
|
|
58
|
+
* @example
|
|
59
|
+
* Note: giving the queryParams is not required.
|
|
60
|
+
* ```js
|
|
61
|
+
* queryParams = {
|
|
62
|
+
* dc: 'dc',
|
|
63
|
+
* device_fp: 'device_fp'
|
|
64
|
+
* }
|
|
65
|
+
* cidaasLoginService.registerWithSocial({
|
|
66
|
+
* provider: 'facebook',
|
|
67
|
+
* requestId: 'your requestId',
|
|
68
|
+
* }, queryParams);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
registerWithSocial(options, queryParams) {
|
|
72
|
+
try {
|
|
73
|
+
let _serviceURL = this.config.authority + "/login-srv/social/register/" + options.provider.toLowerCase() + "/" + options.requestId;
|
|
74
|
+
if (queryParams && queryParams.dc && queryParams.device_fp) {
|
|
75
|
+
_serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
|
|
76
|
+
}
|
|
77
|
+
window.location.href = _serviceURL;
|
|
78
|
+
}
|
|
79
|
+
catch (ex) {
|
|
80
|
+
console.log(ex);
|
|
81
|
+
}
|
|
125
82
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
83
|
+
/**
|
|
84
|
+
* To authenticate without using password, call **passwordlessLogin()**.
|
|
85
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/k1lwsraxk0rjc-login-passwordless-request for more details.
|
|
86
|
+
* @example
|
|
87
|
+
* ```js
|
|
88
|
+
* cidaasLoginService.passwordlessLogin({
|
|
89
|
+
* requestId: 'your requestId',
|
|
90
|
+
* sub: 'your user sub',
|
|
91
|
+
* statusId: 'status id from authenticateMFA()'
|
|
92
|
+
* verificationType: 'your verificationType. e.g. VerificationType.Email'
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
passwordlessLogin(options) {
|
|
97
|
+
try {
|
|
98
|
+
const url = this.config.authority + "/login-srv/verification/login";
|
|
99
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
100
|
+
document.body.appendChild(form);
|
|
101
|
+
form.submit();
|
|
102
|
+
}
|
|
103
|
+
catch (ex) {
|
|
104
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
105
|
+
}
|
|
145
106
|
}
|
|
146
|
-
|
|
147
|
-
|
|
107
|
+
/**
|
|
108
|
+
* To continue after Consent acceptance, call **consentContinue()**.
|
|
109
|
+
* @example
|
|
110
|
+
* ```js
|
|
111
|
+
* cidaasLoginService.consentContinue({
|
|
112
|
+
* track_id: 'your track id'
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
consentContinue(options) {
|
|
117
|
+
try {
|
|
118
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
119
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
120
|
+
document.body.appendChild(form);
|
|
121
|
+
form.submit();
|
|
122
|
+
}
|
|
123
|
+
catch (ex) {
|
|
124
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
125
|
+
}
|
|
148
126
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.loginSettingsId;
|
|
170
|
-
const form = Helper_1.Helper.createForm(url, options);
|
|
171
|
-
document.body.appendChild(form);
|
|
172
|
-
form.submit();
|
|
127
|
+
/**
|
|
128
|
+
* To continue after MFA completion, call **mfaContinue()**.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```js
|
|
132
|
+
* cidaasLoginService.mfaContinue({
|
|
133
|
+
* track_id: 'your track id'
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
mfaContinue(options) {
|
|
138
|
+
try {
|
|
139
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
140
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
141
|
+
document.body.appendChild(form);
|
|
142
|
+
form.submit();
|
|
143
|
+
}
|
|
144
|
+
catch (ex) {
|
|
145
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
146
|
+
}
|
|
173
147
|
}
|
|
174
|
-
|
|
175
|
-
|
|
148
|
+
/**
|
|
149
|
+
* to handle changing password by first login attempt after registration, call **firstTimeChangePassword()**.
|
|
150
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/fd8f478d96f58-continue-authentication-flow-after-prechecks for more details.
|
|
151
|
+
* @example
|
|
152
|
+
* ```js
|
|
153
|
+
* cidaasLoginService.firstTimeChangePassword({
|
|
154
|
+
* old_password: 'your old password',
|
|
155
|
+
* new_password: 'your new password',
|
|
156
|
+
* confirm_password: 'your new password'
|
|
157
|
+
* }, 'your track id');
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
firstTimeChangePassword(options, trackId) {
|
|
161
|
+
try {
|
|
162
|
+
const url = this.config.authority + "/login-srv/precheck/continue/" + trackId;
|
|
163
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
164
|
+
document.body.appendChild(form);
|
|
165
|
+
form.submit();
|
|
166
|
+
}
|
|
167
|
+
catch (ex) {
|
|
168
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
169
|
+
}
|
|
176
170
|
}
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
171
|
+
/**
|
|
172
|
+
* 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.
|
|
173
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/l7sknp2pytryr-progressive-registration for more details.
|
|
174
|
+
* @example
|
|
175
|
+
* ```js
|
|
176
|
+
* const options = {
|
|
177
|
+
* sub: 'your sub',
|
|
178
|
+
* }
|
|
179
|
+
* const headers = {
|
|
180
|
+
* trackId: 'the track id received while logging in',
|
|
181
|
+
* requestId: 'request id of the session',
|
|
182
|
+
* acceptlanguage: 'your locale/browser locale (OPTIONAL)',
|
|
183
|
+
* }
|
|
184
|
+
* cidaasLoginService.progressiveRegistration(options, headers)
|
|
185
|
+
* .then(function(response) {
|
|
186
|
+
* // type your code here
|
|
187
|
+
* })
|
|
188
|
+
* .catch(function (ex) {
|
|
189
|
+
* // your failure code here
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
progressiveRegistration(options, headers) {
|
|
194
|
+
const serviceURL = this.config.authority + "/login-srv/progressive/update/user";
|
|
195
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, "POST", undefined, headers);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* 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.
|
|
199
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
|
|
200
|
+
* @example
|
|
201
|
+
* ```js
|
|
202
|
+
* cidaasLoginService.loginAfterRegister({
|
|
203
|
+
* device_id: 'your device id',
|
|
204
|
+
* dc: 'device capacity'
|
|
205
|
+
* rememberMe: false,
|
|
206
|
+
* trackId: 'your track id',
|
|
207
|
+
* device_fp: 'device fingerprint'
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
loginAfterRegister(options) {
|
|
212
|
+
try {
|
|
213
|
+
const url = this.config.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
|
|
214
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
215
|
+
document.body.appendChild(form);
|
|
216
|
+
form.submit();
|
|
217
|
+
}
|
|
218
|
+
catch (ex) {
|
|
219
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
220
|
+
}
|
|
226
221
|
}
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
/**
|
|
223
|
+
* To do guest login after activating the feature from admin ui, call **actionGuestLogin()**
|
|
224
|
+
* Please refer to https://docs.cidaas.com/docs/cidaas-iam/95fd8492a64fe-guest-login for more details
|
|
225
|
+
* @example
|
|
226
|
+
* ```js
|
|
227
|
+
* cidaasLoginService.actionGuestLogin('your request id');
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
actionGuestLogin(requestId) {
|
|
231
|
+
const url = this.config.authority + '/login-srv/login/guest/' + requestId;
|
|
232
|
+
const loginFormElement = document.getElementsByName('guestLoginForm')[0];
|
|
233
|
+
loginFormElement.action = url;
|
|
234
|
+
loginFormElement.method = 'post';
|
|
235
|
+
loginFormElement.submit();
|
|
229
236
|
}
|
|
230
237
|
}
|
|
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;
|
|
238
|
+
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
|
}
|
|
@@ -62,59 +53,26 @@ export interface PasswordlessLoginRequest {
|
|
|
62
53
|
status_id: string;
|
|
63
54
|
/**
|
|
64
55
|
* Type of verification to be used to authenticate user
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
verificationType: VerificationType | string;
|
|
56
|
+
*/
|
|
57
|
+
verificationType: VerificationType;
|
|
68
58
|
/**
|
|
69
59
|
* Masked sub (id of user)
|
|
70
60
|
* Either sub or q have to be provided, depends on what is given from the query parameter.
|
|
71
|
-
|
|
61
|
+
*/
|
|
72
62
|
sub?: string;
|
|
73
63
|
/**
|
|
74
64
|
* Masked sub (id of user)
|
|
75
65
|
* 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 {
|
|
66
|
+
*/
|
|
81
67
|
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
68
|
}
|
|
105
69
|
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
70
|
/** Old password to be changed */
|
|
109
71
|
old_password: string;
|
|
110
72
|
/** New password to replaced old password */
|
|
111
73
|
new_password: string;
|
|
112
74
|
/** Needed to confirm new password */
|
|
113
75
|
confirm_password: string;
|
|
114
|
-
sub?: string;
|
|
115
|
-
identityId?: string;
|
|
116
|
-
accessToken?: string;
|
|
117
|
-
client_id?: string;
|
|
118
76
|
}
|
|
119
77
|
export interface ProgressiveRegistrationHeader {
|
|
120
78
|
/** Request id returned from the authorization call */
|
|
@@ -129,8 +87,6 @@ export interface ProgressiveRegistrationHeader {
|
|
|
129
87
|
lon?: string;
|
|
130
88
|
}
|
|
131
89
|
export interface LoginAfterRegisterRequest {
|
|
132
|
-
/** Deprecated: will be removed in the next major release */
|
|
133
|
-
device_id?: string;
|
|
134
90
|
/** Device capacity */
|
|
135
91
|
dc?: string;
|
|
136
92
|
/** 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 = {}));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import ConfigUserProvider from "../common/ConfigUserProvider";
|
|
2
|
+
import { GetRequestIdRequest, GetClientInfoRequest } from "./PublicService.model";
|
|
3
|
+
export declare class PublicService {
|
|
4
|
+
private config;
|
|
5
|
+
constructor(configUserProvider: ConfigUserProvider);
|
|
6
|
+
/**
|
|
7
|
+
* Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call **getRequestId()**.
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* // To get requestId using default configured settings, run the function without parameter
|
|
11
|
+
* cidaasPublicService.getRequestId().then(function (response) {
|
|
12
|
+
* // the response will give you request id.
|
|
13
|
+
* }).catch(function(ex) {
|
|
14
|
+
* // your failure code here
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // To get requestId using custom settings, run the function with custom setting(s) inside option parameter. Example below will only override client_id & redirect_uri
|
|
18
|
+
* const option: GetRequestIdRequest = {
|
|
19
|
+
* 'client_id': 'your client id',
|
|
20
|
+
* 'redirect_uri': 'your redirect url',
|
|
21
|
+
* }
|
|
22
|
+
* cidaasPublicService.getRequestId(option).then(function (response) {
|
|
23
|
+
* // the response will give you request id.
|
|
24
|
+
* }).catch(function(ex) {
|
|
25
|
+
* // your failure code here
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
getRequestId(option?: GetRequestIdRequest): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* To get the tenant basic information, call **getTenantInfo()**. This will return the basic tenant details such as tenant name and allowed login with types (Email, Mobile, Username).
|
|
32
|
+
* @example
|
|
33
|
+
* ```js
|
|
34
|
+
* cidaasPublicService.getTenantInfo().then(function (response) {
|
|
35
|
+
* // the response will give you tenant details
|
|
36
|
+
* }).catch(function(ex) {
|
|
37
|
+
* // your failure code here
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
getTenantInfo(): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* To get the client basic information, call **getClientInfo()**. This will return the basic client details such as client name and its details.
|
|
44
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/dc8a6cfb28abb-public-page-information for more details.
|
|
45
|
+
* @example
|
|
46
|
+
* ```js
|
|
47
|
+
* cidaasPublicService.getClientInfo({
|
|
48
|
+
* requestId: 'your requestId',
|
|
49
|
+
* }).then(function (resp) {
|
|
50
|
+
* // the response will give you client info.
|
|
51
|
+
* }).catch(function(ex) {
|
|
52
|
+
* // your failure code here
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
getClientInfo(options: GetClientInfoRequest): Promise<any>;
|
|
57
|
+
}
|