cidaas-javascript-sdk 4.2.3 → 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 +23 -3
- package/README.md +3 -0
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +21 -10
- package/dist/authentication/Authentication.model.js +23 -0
- 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 +17 -12
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +13 -9
- 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 +20 -3
- 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 +98 -123
- 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/authentication/authentication.model.js +0 -18
- package/dist/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -133
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -59
- 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 -243
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -246
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -468
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -275
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { AuthenticateMFARequest, CancelMFARequest, CheckVerificationTypeConfiguredRequest, ConfigureFriendlyNameRequest, ConfigureVerificationRequest, EnrollVerificationRequest, GetMFAListRequest, InitiateAccountVerificationRequest, InitiateEnrollmentRequest, InitiateMFARequest, InitiateVerificationRequest, VerifyAccountRequest } from "./VerificationService.model";
|
|
2
|
+
/**
|
|
3
|
+
* To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
4
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
|
|
5
|
+
* @example
|
|
6
|
+
* ```js
|
|
7
|
+
* cidaas.initiateAccountVerification({
|
|
8
|
+
* verificationMedium: 'email',
|
|
9
|
+
* requestId: 'your requestId',
|
|
10
|
+
* processingType: ProcessingType.CODE,
|
|
11
|
+
* email: 'your email'
|
|
12
|
+
* }).then(function (response) {
|
|
13
|
+
* // the response will give you account verification details.
|
|
14
|
+
* }).catch(function(ex) {
|
|
15
|
+
* // your failure code here
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function initiateAccountVerification(options: InitiateAccountVerificationRequest): void;
|
|
20
|
+
/**
|
|
21
|
+
* To complete the verification, call **verifyAccount()**.
|
|
22
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
|
|
23
|
+
* @example
|
|
24
|
+
* ```js
|
|
25
|
+
* cidaas.verifyAccount({
|
|
26
|
+
* accvid: 'your accvid', // which you will get on initiate account verification response
|
|
27
|
+
* code: 'your code in email or sms or ivr'
|
|
28
|
+
* }).then(function (response) {
|
|
29
|
+
* // the response will give you account verification ID and unique code.
|
|
30
|
+
* }).catch(function(ex) {
|
|
31
|
+
* // your failure code here
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function verifyAccount(options: VerifyAccountRequest): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* To get all configured multi factor authentication, call **getMFAList()**.
|
|
38
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
|
|
39
|
+
* @example
|
|
40
|
+
* ```js
|
|
41
|
+
* cidaas.getMFAList({
|
|
42
|
+
* request_id: 'your request id',
|
|
43
|
+
* email: 'your email'
|
|
44
|
+
* }).then(function (response) {
|
|
45
|
+
* // the response will give you list of configured multi factor authentication
|
|
46
|
+
* }).catch(function(ex) {
|
|
47
|
+
* // your failure code here
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function getMFAList(options: GetMFAListRequest): Promise<any>;
|
|
52
|
+
/**
|
|
53
|
+
* to cancel mfa process, call **cancelMFA()**.
|
|
54
|
+
* @example
|
|
55
|
+
* ```js
|
|
56
|
+
* cidaas.cancelMFA({
|
|
57
|
+
* exchange_id: 'exchange id from initiateMFA() response',
|
|
58
|
+
* reason: 'reason of mfa cancelation',
|
|
59
|
+
* type: 'authentication type e.g. email'
|
|
60
|
+
* }).then(function (response) {
|
|
61
|
+
* // your success code here
|
|
62
|
+
* }).catch(function(ex) {
|
|
63
|
+
* // your failure code here
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function cancelMFA(options: CancelMFARequest): Promise<any>;
|
|
68
|
+
/**
|
|
69
|
+
* To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
|
|
70
|
+
* @example
|
|
71
|
+
* ```js
|
|
72
|
+
* const access_token = "your access token";
|
|
73
|
+
*
|
|
74
|
+
* cidaas.getAllVerificationList(access_token)
|
|
75
|
+
* .then(function (response) {
|
|
76
|
+
* // type your code here
|
|
77
|
+
* })
|
|
78
|
+
* .catch(function (ex) {
|
|
79
|
+
* // your failure code here
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function getAllVerificationList(access_token: string): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
|
|
86
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
|
|
87
|
+
* @example
|
|
88
|
+
* ```js
|
|
89
|
+
* const access_token = "your access token";
|
|
90
|
+
* const options = {
|
|
91
|
+
* verification_type: 'one of verification_type such as fido2, face, ivr',
|
|
92
|
+
* deviceInfo: {
|
|
93
|
+
* deviceId: '',
|
|
94
|
+
* location: {lat: '', lon: ''}
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* cidaas.initiateEnrollment(options, access_token)
|
|
99
|
+
* .then(function (response) {
|
|
100
|
+
* // type your code here
|
|
101
|
+
* })
|
|
102
|
+
* .catch(function (ex) {
|
|
103
|
+
* // your failure code here
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function initiateEnrollment(options: InitiateEnrollmentRequest, accessToken: string): Promise<any>;
|
|
108
|
+
/**
|
|
109
|
+
* to get the status of MFA enrollment, call **getEnrollmentStatus()**.
|
|
110
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
|
|
111
|
+
* @example
|
|
112
|
+
* ```js
|
|
113
|
+
* cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
|
|
114
|
+
* .then(function (response) {
|
|
115
|
+
* // type your code here
|
|
116
|
+
* })
|
|
117
|
+
* .catch(function (ex) {
|
|
118
|
+
* // your failure code here
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function getEnrollmentStatus(status_id: string, accessToken: string): Promise<any>;
|
|
123
|
+
/**
|
|
124
|
+
* to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
|
|
125
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
|
|
126
|
+
* @example
|
|
127
|
+
* ```js
|
|
128
|
+
* const fidoPayload = {
|
|
129
|
+
* sub: 'your sub',
|
|
130
|
+
* exchange_id: 'exchange_id from initiateEnrollment()',
|
|
131
|
+
* verification_type: 'fido2',
|
|
132
|
+
* fido2_client_response: {
|
|
133
|
+
* client_response: 'client_response from doing fido process',
|
|
134
|
+
* fidoRequestId: 'fidoRequestId from initiateEnrollment',
|
|
135
|
+
* }
|
|
136
|
+
* }
|
|
137
|
+
* cidaas.enrollVerification(fidoPayload)
|
|
138
|
+
* .then(function (response) {
|
|
139
|
+
* // type your code here
|
|
140
|
+
* })
|
|
141
|
+
* .catch(function (ex) {
|
|
142
|
+
* // your failure code here
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function enrollVerification(options: EnrollVerificationRequest): Promise<any>;
|
|
147
|
+
/**
|
|
148
|
+
* to see details of configured verification type, call **checkVerificationTypeConfigured()**.
|
|
149
|
+
* @example
|
|
150
|
+
* ```js
|
|
151
|
+
* cidaas.checkVerificationTypeConfigured({
|
|
152
|
+
* request_id: 'your request id',
|
|
153
|
+
* email: 'your email',
|
|
154
|
+
* verification_type: 'email'
|
|
155
|
+
* }).then(function (response) {
|
|
156
|
+
* // type your code here
|
|
157
|
+
* })
|
|
158
|
+
* .catch(function (ex) {
|
|
159
|
+
* // your failure code here
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare function checkVerificationTypeConfigured(options: CheckVerificationTypeConfiguredRequest): Promise<any>;
|
|
164
|
+
/**
|
|
165
|
+
* to initiate multi factor auhentication, call **initiateMFA()**.
|
|
166
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
|
|
167
|
+
* @example
|
|
168
|
+
* ```js
|
|
169
|
+
* const access_token = "your access token";
|
|
170
|
+
* const options = {
|
|
171
|
+
* request_id: 'your request id',
|
|
172
|
+
* usage_type: 'PASSWORDLESS_AUTHENTICATION',
|
|
173
|
+
* type: 'email'
|
|
174
|
+
* email: 'your email'
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* cidaas.initiateMFA(options, access_token)
|
|
179
|
+
* .then(function (response) {
|
|
180
|
+
* // type your code here
|
|
181
|
+
* })
|
|
182
|
+
* .catch(function (ex) {
|
|
183
|
+
* // your failure code here
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function initiateMFA(options: InitiateMFARequest, accessToken?: string): Promise<any>;
|
|
188
|
+
/**
|
|
189
|
+
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
190
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
191
|
+
* @example
|
|
192
|
+
* ```js
|
|
193
|
+
* cidaas.authenticateMFA({
|
|
194
|
+
* type: 'email',
|
|
195
|
+
* client_id: 'your client id',
|
|
196
|
+
* exchange_id: exchange id from initiateMFA(),
|
|
197
|
+
* pass_code: 'code to authenticate'
|
|
198
|
+
* }).then(function (response) {
|
|
199
|
+
* // type your code here
|
|
200
|
+
* })
|
|
201
|
+
* .catch(function (ex) {
|
|
202
|
+
* // your failure code here
|
|
203
|
+
* });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare function authenticateMFA(options: AuthenticateMFARequest): Promise<any>;
|
|
207
|
+
/**
|
|
208
|
+
* to initiate verification process, call **initiateVerification**
|
|
209
|
+
*/
|
|
210
|
+
export declare function initiateVerification(options: InitiateVerificationRequest, trackId: string, method: string): Promise<any>;
|
|
211
|
+
/**
|
|
212
|
+
* to finish configuring verification process, call **configureVerification**
|
|
213
|
+
*/
|
|
214
|
+
export declare function configureVerification(options: ConfigureVerificationRequest, method: string): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* to configure friendly name, call **configureFriendlyName**
|
|
217
|
+
*/
|
|
218
|
+
export declare function configureFriendlyName(options: ConfigureFriendlyNameRequest, trackId: string, method: string): Promise<any>;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureFriendlyName = exports.configureVerification = exports.initiateVerification = exports.authenticateMFA = exports.initiateMFA = exports.checkVerificationTypeConfigured = exports.enrollVerification = exports.getEnrollmentStatus = exports.initiateEnrollment = exports.getAllVerificationList = exports.cancelMFA = exports.getMFAList = exports.verifyAccount = exports.initiateAccountVerification = void 0;
|
|
4
|
+
const Helper_1 = require("../common/Helper");
|
|
5
|
+
/**
|
|
6
|
+
* To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
7
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* cidaas.initiateAccountVerification({
|
|
11
|
+
* verificationMedium: 'email',
|
|
12
|
+
* requestId: 'your requestId',
|
|
13
|
+
* processingType: ProcessingType.CODE,
|
|
14
|
+
* email: 'your email'
|
|
15
|
+
* }).then(function (response) {
|
|
16
|
+
* // the response will give you account verification details.
|
|
17
|
+
* }).catch(function(ex) {
|
|
18
|
+
* // your failure code here
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function initiateAccountVerification(options) {
|
|
23
|
+
try {
|
|
24
|
+
const url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
|
|
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
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.initiateAccountVerification = initiateAccountVerification;
|
|
34
|
+
/**
|
|
35
|
+
* To complete the verification, call **verifyAccount()**.
|
|
36
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
|
|
37
|
+
* @example
|
|
38
|
+
* ```js
|
|
39
|
+
* cidaas.verifyAccount({
|
|
40
|
+
* accvid: 'your accvid', // which you will get on initiate account verification response
|
|
41
|
+
* code: 'your code in email or sms or ivr'
|
|
42
|
+
* }).then(function (response) {
|
|
43
|
+
* // the response will give you account verification ID and unique code.
|
|
44
|
+
* }).catch(function(ex) {
|
|
45
|
+
* // your failure code here
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
function verifyAccount(options) {
|
|
50
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
|
|
51
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
52
|
+
}
|
|
53
|
+
exports.verifyAccount = verifyAccount;
|
|
54
|
+
/**
|
|
55
|
+
* To get all configured multi factor authentication, call **getMFAList()**.
|
|
56
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
|
|
57
|
+
* @example
|
|
58
|
+
* ```js
|
|
59
|
+
* cidaas.getMFAList({
|
|
60
|
+
* request_id: 'your request id',
|
|
61
|
+
* email: 'your email'
|
|
62
|
+
* }).then(function (response) {
|
|
63
|
+
* // the response will give you list of configured multi factor authentication
|
|
64
|
+
* }).catch(function(ex) {
|
|
65
|
+
* // your failure code here
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
function getMFAList(options) {
|
|
70
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/list";
|
|
71
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
72
|
+
}
|
|
73
|
+
exports.getMFAList = getMFAList;
|
|
74
|
+
/**
|
|
75
|
+
* to cancel mfa process, call **cancelMFA()**.
|
|
76
|
+
* @example
|
|
77
|
+
* ```js
|
|
78
|
+
* cidaas.cancelMFA({
|
|
79
|
+
* exchange_id: 'exchange id from initiateMFA() response',
|
|
80
|
+
* reason: 'reason of mfa cancelation',
|
|
81
|
+
* type: 'authentication type e.g. email'
|
|
82
|
+
* }).then(function (response) {
|
|
83
|
+
* // your success code here
|
|
84
|
+
* }).catch(function(ex) {
|
|
85
|
+
* // your failure code here
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
function cancelMFA(options) {
|
|
90
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
|
|
91
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
92
|
+
}
|
|
93
|
+
exports.cancelMFA = cancelMFA;
|
|
94
|
+
/**
|
|
95
|
+
* To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
|
|
96
|
+
* @example
|
|
97
|
+
* ```js
|
|
98
|
+
* const access_token = "your access token";
|
|
99
|
+
*
|
|
100
|
+
* cidaas.getAllVerificationList(access_token)
|
|
101
|
+
* .then(function (response) {
|
|
102
|
+
* // type your code here
|
|
103
|
+
* })
|
|
104
|
+
* .catch(function (ex) {
|
|
105
|
+
* // your failure code here
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
function getAllVerificationList(access_token) {
|
|
110
|
+
const _serviceURL = `${window.webAuthSettings.authority}/verification-srv/config/list`;
|
|
111
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token);
|
|
112
|
+
}
|
|
113
|
+
exports.getAllVerificationList = getAllVerificationList;
|
|
114
|
+
/**
|
|
115
|
+
* To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
|
|
116
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
|
|
117
|
+
* @example
|
|
118
|
+
* ```js
|
|
119
|
+
* const access_token = "your access token";
|
|
120
|
+
* const options = {
|
|
121
|
+
* verification_type: 'one of verification_type such as fido2, face, ivr',
|
|
122
|
+
* deviceInfo: {
|
|
123
|
+
* deviceId: '',
|
|
124
|
+
* location: {lat: '', lon: ''}
|
|
125
|
+
* }
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
* cidaas.initiateEnrollment(options, access_token)
|
|
129
|
+
* .then(function (response) {
|
|
130
|
+
* // type your code here
|
|
131
|
+
* })
|
|
132
|
+
* .catch(function (ex) {
|
|
133
|
+
* // your failure code here
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
function initiateEnrollment(options, accessToken) {
|
|
138
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
|
|
139
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
|
|
140
|
+
}
|
|
141
|
+
exports.initiateEnrollment = initiateEnrollment;
|
|
142
|
+
/**
|
|
143
|
+
* to get the status of MFA enrollment, call **getEnrollmentStatus()**.
|
|
144
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
|
|
145
|
+
* @example
|
|
146
|
+
* ```js
|
|
147
|
+
* cidaas.getEnrollmentStatus('statusId from initiateEnrollment()', 'your access token')
|
|
148
|
+
* .then(function (response) {
|
|
149
|
+
* // type your code here
|
|
150
|
+
* })
|
|
151
|
+
* .catch(function (ex) {
|
|
152
|
+
* // your failure code here
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
function getEnrollmentStatus(status_id, accessToken) {
|
|
157
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
158
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken);
|
|
159
|
+
}
|
|
160
|
+
exports.getEnrollmentStatus = getEnrollmentStatus;
|
|
161
|
+
/**
|
|
162
|
+
* to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
|
|
163
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
|
|
164
|
+
* @example
|
|
165
|
+
* ```js
|
|
166
|
+
* const fidoPayload = {
|
|
167
|
+
* sub: 'your sub',
|
|
168
|
+
* exchange_id: 'exchange_id from initiateEnrollment()',
|
|
169
|
+
* verification_type: 'fido2',
|
|
170
|
+
* fido2_client_response: {
|
|
171
|
+
* client_response: 'client_response from doing fido process',
|
|
172
|
+
* fidoRequestId: 'fidoRequestId from initiateEnrollment',
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* cidaas.enrollVerification(fidoPayload)
|
|
176
|
+
* .then(function (response) {
|
|
177
|
+
* // type your code here
|
|
178
|
+
* })
|
|
179
|
+
* .catch(function (ex) {
|
|
180
|
+
* // your failure code here
|
|
181
|
+
* });
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
function enrollVerification(options) {
|
|
185
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
|
|
186
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
187
|
+
}
|
|
188
|
+
exports.enrollVerification = enrollVerification;
|
|
189
|
+
/**
|
|
190
|
+
* to see details of configured verification type, call **checkVerificationTypeConfigured()**.
|
|
191
|
+
* @example
|
|
192
|
+
* ```js
|
|
193
|
+
* cidaas.checkVerificationTypeConfigured({
|
|
194
|
+
* request_id: 'your request id',
|
|
195
|
+
* email: 'your email',
|
|
196
|
+
* verification_type: 'email'
|
|
197
|
+
* }).then(function (response) {
|
|
198
|
+
* // type your code here
|
|
199
|
+
* })
|
|
200
|
+
* .catch(function (ex) {
|
|
201
|
+
* // your failure code here
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
function checkVerificationTypeConfigured(options) {
|
|
206
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
|
|
207
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
208
|
+
}
|
|
209
|
+
exports.checkVerificationTypeConfigured = checkVerificationTypeConfigured;
|
|
210
|
+
/**
|
|
211
|
+
* to initiate multi factor auhentication, call **initiateMFA()**.
|
|
212
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
|
|
213
|
+
* @example
|
|
214
|
+
* ```js
|
|
215
|
+
* const access_token = "your access token";
|
|
216
|
+
* const options = {
|
|
217
|
+
* request_id: 'your request id',
|
|
218
|
+
* usage_type: 'PASSWORDLESS_AUTHENTICATION',
|
|
219
|
+
* type: 'email'
|
|
220
|
+
* email: 'your email'
|
|
221
|
+
* }
|
|
222
|
+
* }
|
|
223
|
+
*
|
|
224
|
+
* cidaas.initiateMFA(options, access_token)
|
|
225
|
+
* .then(function (response) {
|
|
226
|
+
* // type your code here
|
|
227
|
+
* })
|
|
228
|
+
* .catch(function (ex) {
|
|
229
|
+
* // your failure code here
|
|
230
|
+
* });
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
function initiateMFA(options, accessToken) {
|
|
234
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
|
|
235
|
+
// BREAKING TODO: remove accessToken parameter in the next major release
|
|
236
|
+
if (accessToken) {
|
|
237
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", accessToken);
|
|
238
|
+
}
|
|
239
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST");
|
|
240
|
+
}
|
|
241
|
+
exports.initiateMFA = initiateMFA;
|
|
242
|
+
/**
|
|
243
|
+
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
244
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
245
|
+
* @example
|
|
246
|
+
* ```js
|
|
247
|
+
* cidaas.authenticateMFA({
|
|
248
|
+
* type: 'email',
|
|
249
|
+
* client_id: 'your client id',
|
|
250
|
+
* exchange_id: exchange id from initiateMFA(),
|
|
251
|
+
* pass_code: 'code to authenticate'
|
|
252
|
+
* }).then(function (response) {
|
|
253
|
+
* // type your code here
|
|
254
|
+
* })
|
|
255
|
+
* .catch(function (ex) {
|
|
256
|
+
* // your failure code here
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
function authenticateMFA(options) {
|
|
261
|
+
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
|
|
262
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
263
|
+
}
|
|
264
|
+
exports.authenticateMFA = authenticateMFA;
|
|
265
|
+
/**
|
|
266
|
+
* to initiate verification process, call **initiateVerification**
|
|
267
|
+
*/
|
|
268
|
+
function initiateVerification(options, trackId, method) {
|
|
269
|
+
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
|
|
270
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
271
|
+
}
|
|
272
|
+
exports.initiateVerification = initiateVerification;
|
|
273
|
+
/**
|
|
274
|
+
* to finish configuring verification process, call **configureVerification**
|
|
275
|
+
*/
|
|
276
|
+
function configureVerification(options, method) {
|
|
277
|
+
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/verification';
|
|
278
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
279
|
+
}
|
|
280
|
+
exports.configureVerification = configureVerification;
|
|
281
|
+
/**
|
|
282
|
+
* to configure friendly name, call **configureFriendlyName**
|
|
283
|
+
*/
|
|
284
|
+
function configureFriendlyName(options, trackId, method) {
|
|
285
|
+
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
|
|
286
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
|
|
287
|
+
}
|
|
288
|
+
exports.configureFriendlyName = configureFriendlyName;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ProcessingType } from "../common/Common.model";
|
|
2
|
+
export interface InitiateAccountVerificationRequest {
|
|
3
|
+
/** email of user */
|
|
4
|
+
email?: string;
|
|
5
|
+
/** mobile number of user */
|
|
6
|
+
mobile?: string;
|
|
7
|
+
/** phone number of user */
|
|
8
|
+
phone?: string;
|
|
9
|
+
/** username of user */
|
|
10
|
+
username?: string;
|
|
11
|
+
/** described which medium (email, mobile, username) to be used for verifying user */
|
|
12
|
+
verificationMedium?: string;
|
|
13
|
+
/**
|
|
14
|
+
* can be either CODE, LINK, or GENERAL
|
|
15
|
+
* BREAKING TODO: change type to ProcessingType only in next major version
|
|
16
|
+
* */
|
|
17
|
+
processingType?: ProcessingType | string;
|
|
18
|
+
/** Request id returned from the authorization call */
|
|
19
|
+
requestId?: string;
|
|
20
|
+
/** Unique identifier of client app, can be found in app setting under admin ui */
|
|
21
|
+
client_id?: string;
|
|
22
|
+
/** Specify the url where the user needs to be redirected after successful login */
|
|
23
|
+
redirect_uri?: string;
|
|
24
|
+
/** response type expected for the process */
|
|
25
|
+
response_type?: string;
|
|
26
|
+
/** Subject (User) identifier */
|
|
27
|
+
sub?: string;
|
|
28
|
+
/** Refers to a template or predefined message/key associated with the opt-in reminder. */
|
|
29
|
+
templateKey?: string;
|
|
30
|
+
/** name of user */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Response language, which is configured in cidaas admin ui */
|
|
33
|
+
accept_language?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface VerifyAccountRequest {
|
|
36
|
+
/** accvid will be given after initiate account verification process */
|
|
37
|
+
accvid: string;
|
|
38
|
+
/** code which has been sent to predetermined verification medium */
|
|
39
|
+
code: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GetMFAListRequest {
|
|
42
|
+
/** email of user */
|
|
43
|
+
email: string;
|
|
44
|
+
/** Request id returned from the authorization call */
|
|
45
|
+
request_id: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CancelMFARequest {
|
|
48
|
+
/** comes from initiate MFA process */
|
|
49
|
+
exchange_id: string;
|
|
50
|
+
/** reason of cancellation */
|
|
51
|
+
reason: string;
|
|
52
|
+
/** MFA type */
|
|
53
|
+
type: string;
|
|
54
|
+
}
|
|
55
|
+
export interface InitiateEnrollmentRequest {
|
|
56
|
+
/** type of MFA to be used for verification */
|
|
57
|
+
verification_type: string;
|
|
58
|
+
/** details of the device */
|
|
59
|
+
deviceInfo?: DeviceInfo;
|
|
60
|
+
}
|
|
61
|
+
export interface EnrollVerificationRequest {
|
|
62
|
+
/** subject (User) identifier */
|
|
63
|
+
sub?: string;
|
|
64
|
+
/** comes from initiate MFA process */
|
|
65
|
+
exchange_id?: string;
|
|
66
|
+
/** type of MFA to be used for verification */
|
|
67
|
+
verification_type?: string;
|
|
68
|
+
/** the message that a client sends to a server after successfully authenticating a user using public key cryptography */
|
|
69
|
+
fido2_client_response?: FIDO2EnrollEntity;
|
|
70
|
+
/** id of the device */
|
|
71
|
+
device_id?: string;
|
|
72
|
+
/** unique identifier of client app, can be found in app setting under admin ui */
|
|
73
|
+
client_id?: string;
|
|
74
|
+
/** code to authenticae */
|
|
75
|
+
pass_code?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface CheckVerificationTypeConfiguredRequest extends GetMFAListRequest {
|
|
78
|
+
/** type of MFA to be used for verification */
|
|
79
|
+
verification_type: string;
|
|
80
|
+
}
|
|
81
|
+
export interface InitiateMFARequest {
|
|
82
|
+
/** user subject identifier */
|
|
83
|
+
sub?: string;
|
|
84
|
+
/** user email */
|
|
85
|
+
email?: string;
|
|
86
|
+
/** user mobile number */
|
|
87
|
+
mobile_number?: string;
|
|
88
|
+
/** application request id, generated by oauth call */
|
|
89
|
+
request_id?: string;
|
|
90
|
+
/** id for medium type (email, sms) */
|
|
91
|
+
medium_id?: string;
|
|
92
|
+
/** Type of authentication */
|
|
93
|
+
usage_type?: string;
|
|
94
|
+
/** medium type */
|
|
95
|
+
type?: string;
|
|
96
|
+
/** predetermined custom fields */
|
|
97
|
+
customFields?: {
|
|
98
|
+
[key: string]: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface AuthenticateMFARequest {
|
|
102
|
+
/** comes from initiate MFA process */
|
|
103
|
+
exchange_id: string;
|
|
104
|
+
/** code which has been sent to predetermined verification type */
|
|
105
|
+
pass_code: string;
|
|
106
|
+
/** type of MFA to be used for verification */
|
|
107
|
+
type: string;
|
|
108
|
+
/** Subject (User) identifier */
|
|
109
|
+
sub?: string;
|
|
110
|
+
/** id generated on Authz request */
|
|
111
|
+
requestId?: PerformanceServerTiming;
|
|
112
|
+
}
|
|
113
|
+
export interface DeviceInfo {
|
|
114
|
+
/** id of the device */
|
|
115
|
+
deviceId: string;
|
|
116
|
+
/** location details of the device */
|
|
117
|
+
location: Location;
|
|
118
|
+
}
|
|
119
|
+
export interface Location {
|
|
120
|
+
/** latitude of the device */
|
|
121
|
+
lat: string;
|
|
122
|
+
/** longitude of the device */
|
|
123
|
+
lon: string;
|
|
124
|
+
}
|
|
125
|
+
export interface FIDO2EnrollEntity {
|
|
126
|
+
/** details of client response */
|
|
127
|
+
client_response?: any;
|
|
128
|
+
/** unique identifier assigned to a FIDO2 authentication request. The value comes from initiate enrollment process */
|
|
129
|
+
fidoRequestId?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface InitiateVerificationRequest {
|
|
132
|
+
/** mobile number */
|
|
133
|
+
mobile_number?: string;
|
|
134
|
+
/** phone number */
|
|
135
|
+
phone?: string;
|
|
136
|
+
/** email address */
|
|
137
|
+
email?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ConfigureVerificationRequest {
|
|
140
|
+
/** comes from initiate MFA process */
|
|
141
|
+
exchange_id: string;
|
|
142
|
+
/** subject (User) identifier */
|
|
143
|
+
sub: string;
|
|
144
|
+
/** code which has been sent to predetermined verification type */
|
|
145
|
+
pass_code: string;
|
|
146
|
+
}
|
|
147
|
+
export interface ConfigureFriendlyNameRequest {
|
|
148
|
+
/** id received from status verification API */
|
|
149
|
+
id?: string;
|
|
150
|
+
/** physical verification id received from status verification api */
|
|
151
|
+
ph_id?: string;
|
|
152
|
+
/** id recevied from enrollment API */
|
|
153
|
+
device_id?: string;
|
|
154
|
+
/** friendly name for the device */
|
|
155
|
+
friendly_name?: string;
|
|
156
|
+
/** subject (User) identifier */
|
|
157
|
+
sub?: string;
|
|
158
|
+
}
|