cidaas-javascript-sdk 4.2.4 → 4.3.1
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 +41 -2
- package/README.md +9 -6
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +2 -9
- package/dist/common/Common.model.d.ts +41 -0
- package/dist/common/Common.model.js +26 -0
- package/dist/{web-auth → common}/Helper.d.ts +6 -6
- package/dist/{web-auth → common}/Helper.js +10 -10
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +8 -8
- package/dist/common/User.model.d.ts +134 -0
- package/dist/common/User.model.js +2 -0
- package/dist/consent-service/ConsentService.d.ts +97 -0
- package/dist/consent-service/ConsentService.js +127 -0
- package/dist/consent-service/ConsentService.model.d.ts +102 -0
- package/dist/consent-service/ConsentService.model.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/login-service/LoginService.d.ts +143 -0
- package/dist/login-service/LoginService.js +247 -0
- package/dist/login-service/LoginService.model.d.ts +142 -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 +219 -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 +138 -178
- package/dist/web-auth/WebAuth.js +183 -177
- package/dist/web-auth/webauth.model.d.ts +66 -0
- package/dist/web-auth/webauth.model.js +2 -0
- package/package.json +2 -2
- package/dist/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -136
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -69
- package/dist/web-auth/JwtHelper.d.ts +0 -7
- package/dist/web-auth/LoginService.d.ts +0 -165
- package/dist/web-auth/LoginService.js +0 -246
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -249
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -471
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -278
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
- /package/dist/authentication/{authentication.model.js → Authentication.model.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,51 @@
|
|
|
1
|
-
## [4.
|
|
1
|
+
## [4.3.1](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v4.3.0...v4.3.1) (2024-11-14)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* [#434](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/issues/434) update javascript sdk redirection in documentation ([5c12adb](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/5c12adbc41f3458425e8faad3c48f6f57201be8b))
|
|
7
|
+
* [#438](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/issues/438) review changes ([d60d3ab](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/d60d3ab5944a14768f064ba2d852924c071faf08))
|
|
8
|
+
* [#438](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/issues/438) test coverage fixes ([49e580d](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/49e580d0650963510cfcd9d29d415814b7a90b5c))
|
|
9
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required ConsentService functions ([f223ebb](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/f223ebb2f00b5350a65106c861d2daff1dda7a2a))
|
|
10
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required ConsentService getConsentDetails function ([b08f870](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/b08f870032c4c24f4bfc51d6a7812964b60b42e0))
|
|
11
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required LoginService functions ([f440983](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/f440983d8e19a4a74a5eff0f1bf321c1f1fe5528))
|
|
12
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required TokenService functions ([89aaf5a](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/89aaf5a15609e1bda80f1965129ffc596f39a4b3))
|
|
13
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required UserService functions ([fa3ad7e](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/fa3ad7e6f93b5bf3d110688c66cf02e2e72924c0))
|
|
14
|
+
* **[270](https://gitlab.widas.de/cidaas-v2/PortalNDashboard-Team/issues/-/issues/270):** add accepting parameter lat, lon in headers in required VerificationService functions ([5e5c1d0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/5e5c1d00453787c56395f35d1fd732d40b1134c5))
|
|
15
|
+
* 438 [Javascript SDK] make getRequestId function flexible ([ff6f2dd](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/ff6f2ddecf7e9029df95935e3ba7d8eb4569e15b))
|
|
16
|
+
* 438 review changes ([6dd54c0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/6dd54c0f258b98d32de851cb27040374fe71c429))
|
|
17
|
+
* Fix vulnerabilities from npm audit ([9e89a88](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/9e89a8827fda8acf2366b1b737fa06593066bb10))
|
|
18
|
+
* update changelog ([1b236b5](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/1b236b56feaf38ec1cdc1118f56deb1a5be0b3c1))
|
|
19
|
+
* upgrade oidc-client-ts from 2.4.0 to 2.4.1 ([126a62f](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/126a62f354d0200dc772798922e584978291b036))
|
|
7
20
|
|
|
8
21
|
# Changelog
|
|
9
22
|
|
|
23
|
+
## V4.3.1
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Update required functions to accept headers
|
|
27
|
+
- Expand resetPassword flow functions with optional handleResponseAsJson for compatibility with older cidaas version
|
|
28
|
+
- Define data model for getRequestId() function payload
|
|
29
|
+
- Expand getRequestId() function with optional payload as parameter
|
|
30
|
+
|
|
31
|
+
### Fix
|
|
32
|
+
- Fix redirection in readme file
|
|
33
|
+
|
|
34
|
+
## V4.3.0
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- add initiateVerification(), configureVerification() & configureFriendlyName() functions to verification service
|
|
38
|
+
- add actionGuestLogin() functions to login service
|
|
39
|
+
- add userActionOnEnrollment() functions to general sdk functions
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- Update project structure
|
|
43
|
+
- Update data model to mirror current cidaas api call
|
|
44
|
+
- Improve documentation
|
|
45
|
+
|
|
46
|
+
### Fix
|
|
47
|
+
- Fix vulnerabilities from `npm audit`
|
|
48
|
+
|
|
10
49
|
## V4.2.4
|
|
11
50
|
|
|
12
51
|
### Fix
|
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ Cidaas Javascript SDK features the following functionality:
|
|
|
114
114
|
|
|
115
115
|
#### Authentication Functions
|
|
116
116
|
|
|
117
|
-
The SDK offers multiple way to authenticate user. Whether using browser redirection, in a pop up window, or in an iframe for silent sign in. The functions for authentication could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/authentication/
|
|
117
|
+
The SDK offers multiple way to authenticate user. Whether using browser redirection, in a pop up window, or in an iframe for silent sign in. The functions for authentication could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/authentication/Authentication.ts)
|
|
118
118
|
|
|
119
119
|
| SDK Functions | Description |
|
|
120
120
|
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -124,7 +124,7 @@ The SDK offers multiple way to authenticate user. Whether using browser redirect
|
|
|
124
124
|
|
|
125
125
|
#### Login Management
|
|
126
126
|
|
|
127
|
-
The login functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/
|
|
127
|
+
The login functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/login-service/LoginService.ts). The SDK support the following login management functions:
|
|
128
128
|
|
|
129
129
|
| SDK Functions | Description |
|
|
130
130
|
|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -132,10 +132,11 @@ The login functions could be found [here](https://github.com/Cidaas/cidaas-javas
|
|
|
132
132
|
| loginPrecheck, consentContinue, firstTimeChangePassword, mfaContinue | Depending on the missing information from loginPrecheck, user will be redirected to another page after login to either accepting consent, changing password, continuing MFA process, or do progressive registration |
|
|
133
133
|
| getMissingFields, progressiveRegistration | In case a new required field is added in registration settings, it is possible to use the sdk to inform user of the changes and asked them to fill in the missing required fields by the next login |
|
|
134
134
|
| loginAfterRegister | By calling this sdk function, user could directly login to the app after successful registration |
|
|
135
|
+
| actionGuestLogin | If user has guestLoginForm prepared, it could be called using this function |
|
|
135
136
|
|
|
136
137
|
#### User Management
|
|
137
138
|
|
|
138
|
-
The user functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/
|
|
139
|
+
The user functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/user-service/UserService.ts). The SDK support the following user management functions:
|
|
139
140
|
|
|
140
141
|
| SDK Functions | Description |
|
|
141
142
|
|-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -150,7 +151,7 @@ The user functions could be found [here](https://github.com/Cidaas/cidaas-javasc
|
|
|
150
151
|
|
|
151
152
|
#### Token Management
|
|
152
153
|
|
|
153
|
-
The token functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/
|
|
154
|
+
The token functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/token-service/TokenService.ts). The SDK support the following token management functions:
|
|
154
155
|
|
|
155
156
|
| SDK Functions | Description |
|
|
156
157
|
|--------------------------------------|-----------------------------------------------------------------------------------------------------|
|
|
@@ -162,7 +163,7 @@ The token functions could be found [here](https://github.com/Cidaas/cidaas-javas
|
|
|
162
163
|
|
|
163
164
|
#### Verification Management
|
|
164
165
|
|
|
165
|
-
The verification functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/
|
|
166
|
+
The verification functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/verification-service/VerificationService.ts). The SDK support the following verification management functions:
|
|
166
167
|
|
|
167
168
|
| SDK Functions | Description |
|
|
168
169
|
|---------------------------------------------------------------------|---------------------------------------------------------------------------------------|
|
|
@@ -171,10 +172,11 @@ The verification functions could be found [here](https://github.com/Cidaas/cidaa
|
|
|
171
172
|
| cancelMFA | MFA process could be aborted in case something go the wrong way |
|
|
172
173
|
| getAllVerificationList, getMFAList, checkVerificationTypeConfigured | Information about every supported MFA Verification types, List of configured MFA, and details about particular configured verification type are provided by the SDK |
|
|
173
174
|
| initiateEnrollment, enrollVerification, getEnrollmentStatus | Additional MFA verification type could be enrolled using the sdk |
|
|
175
|
+
| initiateVerification, configureVerification, configureFriendlyName | The SDK support configuring verification request as well as friendly name |
|
|
174
176
|
|
|
175
177
|
#### Consent Management
|
|
176
178
|
|
|
177
|
-
The consent functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/
|
|
179
|
+
The consent functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/consent-service/ConsentService.ts). The SDK support the following consent management functions:
|
|
178
180
|
|
|
179
181
|
| SDK Functions | Description |
|
|
180
182
|
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
|
|
@@ -193,6 +195,7 @@ general SDK functions could be found [here](https://github.com/Cidaas/cidaas-jav
|
|
|
193
195
|
| setAcceptLanguageHeader | The SDK could be used to change response language |
|
|
194
196
|
| createDeviceInfo, getDevicesInfo, deleteDevice | Creating, getting, and removing device information is supported by the SDK |
|
|
195
197
|
| logoutUser | The SDK could be used to end user session by using cidaas internal api |
|
|
198
|
+
| userActionOnEnrollment | The SDK could be used to run predefined action after enrollment |
|
|
196
199
|
|
|
197
200
|
## Possible Error
|
|
198
201
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OidcManager, OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, SilentSignInOptions, LogoutResponse } from './
|
|
2
|
-
export * from './
|
|
1
|
+
import { OidcManager, OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, SilentSignInOptions, LogoutResponse } from './Authentication.model';
|
|
2
|
+
export * from './Authentication.model';
|
|
3
3
|
export declare class Authentication {
|
|
4
4
|
webAuthSettings: OidcSettings;
|
|
5
5
|
userManager: OidcManager;
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Authentication = void 0;
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./Authentication.model"), exports);
|
|
19
19
|
class Authentication {
|
|
20
20
|
constructor(webAuthSettings, userManager) {
|
|
21
21
|
this.webAuthSettings = webAuthSettings;
|
|
@@ -49,7 +49,6 @@ class Authentication {
|
|
|
49
49
|
}
|
|
50
50
|
return this.userManager.signinRedirect(Object.assign({ extraQueryParams: this.webAuthSettings.extraQueryParams, redirect_uri: this.webAuthSettings.redirect_uri }, (options && Object.assign({}, options) || {})));
|
|
51
51
|
}
|
|
52
|
-
;
|
|
53
52
|
/**
|
|
54
53
|
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
55
54
|
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
@@ -92,7 +91,6 @@ class Authentication {
|
|
|
92
91
|
logoutCallback(url) {
|
|
93
92
|
return this.userManager.signoutRedirectCallback(url);
|
|
94
93
|
}
|
|
95
|
-
;
|
|
96
94
|
/**
|
|
97
95
|
* **popupSignIn()** will open the hosted login page in pop up window.
|
|
98
96
|
* @example
|
|
@@ -108,7 +106,6 @@ class Authentication {
|
|
|
108
106
|
popupSignIn(options) {
|
|
109
107
|
return this.userManager.signinPopup(options);
|
|
110
108
|
}
|
|
111
|
-
;
|
|
112
109
|
/**
|
|
113
110
|
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
114
111
|
* Popup window will be closed after doing callback
|
|
@@ -122,7 +119,6 @@ class Authentication {
|
|
|
122
119
|
popupSignInCallback(url, keepOpen) {
|
|
123
120
|
return this.userManager.signinPopupCallback(url, keepOpen);
|
|
124
121
|
}
|
|
125
|
-
;
|
|
126
122
|
/**
|
|
127
123
|
* **popupSignOut()** will open the hosted logout page in pop up window.
|
|
128
124
|
* @example
|
|
@@ -139,7 +135,6 @@ class Authentication {
|
|
|
139
135
|
popupSignOut(options) {
|
|
140
136
|
return this.userManager.signoutPopup(options);
|
|
141
137
|
}
|
|
142
|
-
;
|
|
143
138
|
/**
|
|
144
139
|
* calling **popupSignOutCallback()** from the popup window complete popup logout process.
|
|
145
140
|
* Popup window won't be closed after doing callback
|
|
@@ -156,9 +151,9 @@ class Authentication {
|
|
|
156
151
|
* @param {boolean} keepOpen true to keep the popup open even after sign out, else false
|
|
157
152
|
*/
|
|
158
153
|
popupSignOutCallback(url, keepOpen = true) {
|
|
154
|
+
url = url !== null && url !== void 0 ? url : this.webAuthSettings.post_logout_redirect_uri;
|
|
159
155
|
return this.userManager.signoutPopupCallback(url, keepOpen);
|
|
160
156
|
}
|
|
161
|
-
;
|
|
162
157
|
/**
|
|
163
158
|
* **silentSignIn()** will open the hosted login page in an iframe.
|
|
164
159
|
* this function could only be called from the same domain. Cross Domain is not supported for security purpose.
|
|
@@ -175,7 +170,6 @@ class Authentication {
|
|
|
175
170
|
silentSignIn(options) {
|
|
176
171
|
return this.userManager.signinSilent(Object.assign({ silentRequestTimeoutInSeconds: 60 }, (options && Object.assign({}, options) || {})));
|
|
177
172
|
}
|
|
178
|
-
;
|
|
179
173
|
/**
|
|
180
174
|
* To complete the silent login process, call **silentSignInCallback()** from the iframe. This will complete the login process in iframe.
|
|
181
175
|
* @example
|
|
@@ -188,6 +182,5 @@ class Authentication {
|
|
|
188
182
|
silentSignInCallback(url) {
|
|
189
183
|
return this.userManager.signinSilentCallback(url);
|
|
190
184
|
}
|
|
191
|
-
;
|
|
192
185
|
}
|
|
193
186
|
exports.Authentication = Authentication;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface LoginPrecheckRequest {
|
|
2
|
+
/** Track id returned from login call */
|
|
3
|
+
track_id: string;
|
|
4
|
+
}
|
|
5
|
+
/** Type of verification to be used to authenticate user */
|
|
6
|
+
export declare enum VerificationType {
|
|
7
|
+
'PASSWORD' = 0,
|
|
8
|
+
'TOUCHID' = 1,
|
|
9
|
+
'FIDO2' = 2,
|
|
10
|
+
'SECURITY_QUESTION' = 3,
|
|
11
|
+
'SMS' = 4,
|
|
12
|
+
'IVR' = 5,
|
|
13
|
+
'FACE' = 6,
|
|
14
|
+
'TOTP' = 7,
|
|
15
|
+
'EMAIL' = 8,
|
|
16
|
+
'BACKUPCODE' = 9,
|
|
17
|
+
'PATTERN' = 10,
|
|
18
|
+
'PUSH' = 11,
|
|
19
|
+
'VOICE' = 12
|
|
20
|
+
}
|
|
21
|
+
export interface HTTPRequestHeader {
|
|
22
|
+
/** Request id returned from the authorization call */
|
|
23
|
+
requestId: string;
|
|
24
|
+
/** DEPRECATED: Captcha string for captcha check */
|
|
25
|
+
captcha?: string;
|
|
26
|
+
/** Response language, which is configured in cidaas admin ui */
|
|
27
|
+
acceptlanguage?: string;
|
|
28
|
+
/** DEPRECATED: Needed in case bot captcha check is activated */
|
|
29
|
+
bot_captcha_response?: string;
|
|
30
|
+
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
31
|
+
trackId?: string;
|
|
32
|
+
/** Latitude is the string location parameter sent in the headers */
|
|
33
|
+
lat?: string;
|
|
34
|
+
/** Longitude is the string location parameter sent in the headers */
|
|
35
|
+
lon?: string;
|
|
36
|
+
}
|
|
37
|
+
/** defines whether the the process will be done via email link or whether the user needs to enter a code to complete the process. */
|
|
38
|
+
export declare enum ProcessingType {
|
|
39
|
+
'CODE' = 0,
|
|
40
|
+
'LINK' = 1
|
|
41
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessingType = exports.VerificationType = void 0;
|
|
4
|
+
/** Type of verification to be used to authenticate user */
|
|
5
|
+
var VerificationType;
|
|
6
|
+
(function (VerificationType) {
|
|
7
|
+
VerificationType[VerificationType["PASSWORD"] = 0] = "PASSWORD";
|
|
8
|
+
VerificationType[VerificationType["TOUCHID"] = 1] = "TOUCHID";
|
|
9
|
+
VerificationType[VerificationType["FIDO2"] = 2] = "FIDO2";
|
|
10
|
+
VerificationType[VerificationType["SECURITY_QUESTION"] = 3] = "SECURITY_QUESTION";
|
|
11
|
+
VerificationType[VerificationType["SMS"] = 4] = "SMS";
|
|
12
|
+
VerificationType[VerificationType["IVR"] = 5] = "IVR";
|
|
13
|
+
VerificationType[VerificationType["FACE"] = 6] = "FACE";
|
|
14
|
+
VerificationType[VerificationType["TOTP"] = 7] = "TOTP";
|
|
15
|
+
VerificationType[VerificationType["EMAIL"] = 8] = "EMAIL";
|
|
16
|
+
VerificationType[VerificationType["BACKUPCODE"] = 9] = "BACKUPCODE";
|
|
17
|
+
VerificationType[VerificationType["PATTERN"] = 10] = "PATTERN";
|
|
18
|
+
VerificationType[VerificationType["PUSH"] = 11] = "PUSH";
|
|
19
|
+
VerificationType[VerificationType["VOICE"] = 12] = "VOICE";
|
|
20
|
+
})(VerificationType = exports.VerificationType || (exports.VerificationType = {}));
|
|
21
|
+
/** defines whether the the process will be done via email link or whether the user needs to enter a code to complete the process. */
|
|
22
|
+
var ProcessingType;
|
|
23
|
+
(function (ProcessingType) {
|
|
24
|
+
ProcessingType[ProcessingType["CODE"] = 0] = "CODE";
|
|
25
|
+
ProcessingType[ProcessingType["LINK"] = 1] = "LINK";
|
|
26
|
+
})(ProcessingType = exports.ProcessingType || (exports.ProcessingType = {}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare class Helper {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
* create form
|
|
4
|
+
* @param form
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
8
|
static createForm(url: string, options: any, method?: string): HTMLFormElement;
|
|
9
9
|
/**
|
|
10
10
|
* utility function to create and make post request
|
|
@@ -15,7 +15,7 @@ export declare class Helper {
|
|
|
15
15
|
* @param headers??
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
static createHttpPromise(options: any, serviceurl: string, errorResolver: boolean, method: string, access_token?: string, headers?: any, formPayload?: FormData): Promise<
|
|
18
|
+
static createHttpPromise(options: any, serviceurl: string, errorResolver: boolean, method: string, access_token?: string, headers?: any, formPayload?: FormData): Promise<any>;
|
|
19
19
|
}
|
|
20
20
|
export declare class CustomException {
|
|
21
21
|
errorMessage: string;
|
|
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CustomException = exports.Helper = void 0;
|
|
4
4
|
class Helper {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
* create form
|
|
7
|
+
* @param form
|
|
8
|
+
* @param options
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
11
|
static createForm(url, options, method = 'POST') {
|
|
12
|
-
|
|
12
|
+
const form = document.createElement('form');
|
|
13
13
|
form.action = url;
|
|
14
14
|
form.method = method;
|
|
15
|
-
for (
|
|
15
|
+
for (const key in options) {
|
|
16
16
|
if (options.hasOwnProperty(key)) {
|
|
17
|
-
|
|
17
|
+
const hiddenField = document.createElement("input");
|
|
18
18
|
hiddenField.setAttribute("type", "hidden");
|
|
19
19
|
hiddenField.setAttribute("name", key);
|
|
20
20
|
hiddenField.setAttribute("value", options[key]);
|
|
@@ -35,7 +35,7 @@ class Helper {
|
|
|
35
35
|
static createHttpPromise(options, serviceurl, errorResolver, method, access_token, headers, formPayload) {
|
|
36
36
|
return new Promise((resolve, reject) => {
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
const http = new XMLHttpRequest();
|
|
39
39
|
http.onreadystatechange = function () {
|
|
40
40
|
if (http.readyState == 4) {
|
|
41
41
|
if (http.responseText) {
|
|
@@ -51,7 +51,7 @@ class Helper {
|
|
|
51
51
|
http.setRequestHeader("Content-type", "application/json");
|
|
52
52
|
}
|
|
53
53
|
if (headers) {
|
|
54
|
-
for (
|
|
54
|
+
for (const key in headers) {
|
|
55
55
|
if (headers.hasOwnProperty(key)) {
|
|
56
56
|
http.setRequestHeader(key, headers[key]);
|
|
57
57
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TokenClaim, TokenHeader } from "../token-service/TokenService.model";
|
|
2
|
+
export declare class JwtHelper {
|
|
3
|
+
static decodeTokenHeader(token: string): TokenHeader;
|
|
4
|
+
static decodeToken(token: string): TokenClaim;
|
|
5
|
+
static urlBase64Decode(str: string): string;
|
|
6
|
+
static b64DecodeUnicode(str: string): string;
|
|
7
|
+
static b64decode(str: string): string;
|
|
8
|
+
}
|
|
@@ -20,11 +20,11 @@ class JwtHelper {
|
|
|
20
20
|
if (token === null) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
const parts = token.split('.');
|
|
24
24
|
if (parts.length !== 3) {
|
|
25
25
|
throw new Error('The inspected token doesn\'t appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.');
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const decoded = this.urlBase64Decode(parts[1]);
|
|
28
28
|
if (!decoded) {
|
|
29
29
|
throw new Error('Cannot decode the token.');
|
|
30
30
|
}
|
|
@@ -59,7 +59,7 @@ class JwtHelper {
|
|
|
59
59
|
}
|
|
60
60
|
// credits for decoder goes to https://github.com/atk
|
|
61
61
|
static b64decode(str) {
|
|
62
|
-
|
|
62
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
63
63
|
let output = '';
|
|
64
64
|
str = String(str).replace(/=+$/, '');
|
|
65
65
|
if (str.length % 4 === 1) {
|
|
@@ -67,19 +67,19 @@ class JwtHelper {
|
|
|
67
67
|
}
|
|
68
68
|
for (
|
|
69
69
|
// initialize result and counters
|
|
70
|
-
let bc = 0, bs,
|
|
70
|
+
let bc = 0, bs, bufferAsNumber, bufferAsString, idx = 0;
|
|
71
71
|
// get next character
|
|
72
|
-
(
|
|
72
|
+
(bufferAsString = str.charAt(idx++));
|
|
73
73
|
// character found in table? initialize bit storage and add its ascii value;
|
|
74
|
-
~
|
|
75
|
-
((bs = bc % 4 ? bs * 64 +
|
|
74
|
+
~bufferAsNumber &&
|
|
75
|
+
((bs = bc % 4 ? bs * 64 + bufferAsNumber : bufferAsNumber),
|
|
76
76
|
// and if not first of each 4 characters,
|
|
77
77
|
// convert the first 8 bits to one ascii character
|
|
78
78
|
bc++ % 4)
|
|
79
79
|
? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
|
|
80
80
|
: 0) {
|
|
81
81
|
// try to find character in table (0-63, not found => -1)
|
|
82
|
-
|
|
82
|
+
bufferAsNumber = chars.indexOf(bufferAsString);
|
|
83
83
|
}
|
|
84
84
|
return output;
|
|
85
85
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export interface CidaasUser {
|
|
2
|
+
/** Status of User */
|
|
3
|
+
userStatus?: string;
|
|
4
|
+
/** DEPRECATED: use userStatus variable instead */
|
|
5
|
+
user_status?: string;
|
|
6
|
+
/** Reason for user status */
|
|
7
|
+
user_status_reason?: string;
|
|
8
|
+
/** Username of the user */
|
|
9
|
+
username?: string;
|
|
10
|
+
/** Subject (User) identifier */
|
|
11
|
+
sub?: string;
|
|
12
|
+
/** UserId from original provider. The value comes from custom/social provider to be referenced */
|
|
13
|
+
originalProviderUserId?: string[];
|
|
14
|
+
/** Given/first name of the user */
|
|
15
|
+
given_name?: string;
|
|
16
|
+
/** Surname or last name of the user */
|
|
17
|
+
family_name?: string;
|
|
18
|
+
/** Middle name of the user */
|
|
19
|
+
middle_name?: string;
|
|
20
|
+
/** Casual name of the user */
|
|
21
|
+
nickname?: string;
|
|
22
|
+
/** Email of the user in string */
|
|
23
|
+
email?: string;
|
|
24
|
+
/** Described whether user email has been verified */
|
|
25
|
+
email_verified?: boolean;
|
|
26
|
+
/** Mobile number of the user in string format */
|
|
27
|
+
mobile_number?: string;
|
|
28
|
+
/** Mobile number of the user as object */
|
|
29
|
+
mobile_number_obj?: UserMobile;
|
|
30
|
+
/** Described whether user mobile number has been verified */
|
|
31
|
+
mobile_number_verified?: boolean;
|
|
32
|
+
/** Phone number of the user in string format */
|
|
33
|
+
phone_number?: string;
|
|
34
|
+
/** Phone number of the user as object */
|
|
35
|
+
phone_number_obj?: UserMobile;
|
|
36
|
+
/** Described whether user phone number has been verified */
|
|
37
|
+
phone_number_verified?: boolean;
|
|
38
|
+
/** URL of the user's profile page */
|
|
39
|
+
profile?: string;
|
|
40
|
+
/** URL of the user's profile picture */
|
|
41
|
+
picture?: string;
|
|
42
|
+
/** URL of the user's web page or blog */
|
|
43
|
+
website?: string;
|
|
44
|
+
/** User's gender */
|
|
45
|
+
gender?: string;
|
|
46
|
+
/** Represents the user's time zone */
|
|
47
|
+
zoneinfo?: string;
|
|
48
|
+
/** Preferred locale of the user */
|
|
49
|
+
locale?: string;
|
|
50
|
+
/** User's birthdate in the format 'YYYY-MM-DD' */
|
|
51
|
+
birthdate?: Date | string;
|
|
52
|
+
/** Address of the user */
|
|
53
|
+
address?: UserAddress;
|
|
54
|
+
/** Represents custom-specific fields that need to be configured in the system */
|
|
55
|
+
customFields?: any;
|
|
56
|
+
/** Custom fileds for identity */
|
|
57
|
+
identityCustomFields?: any;
|
|
58
|
+
/** Password of a user */
|
|
59
|
+
password?: string;
|
|
60
|
+
/** Password confirm of a user */
|
|
61
|
+
password_echo?: string;
|
|
62
|
+
/** Hash info of the password */
|
|
63
|
+
password_hash_info?: any | null;
|
|
64
|
+
/** Described wheter new password needs to be generated by the next login */
|
|
65
|
+
generate_password?: boolean;
|
|
66
|
+
/** Provider name indicating the origin of the social identity */
|
|
67
|
+
provider?: string;
|
|
68
|
+
/** the identityId identifying the useraccount and identity uniquely */
|
|
69
|
+
identityId?: string;
|
|
70
|
+
/** User Id of provider. The value comes from custom/social provider to be referenced */
|
|
71
|
+
providerUserId?: string;
|
|
72
|
+
/** List of BusinessId of provider. The value comes from custom/social provider to be referenced */
|
|
73
|
+
providerBusinessIds?: string[];
|
|
74
|
+
/** Street Address of a user */
|
|
75
|
+
street_address?: string;
|
|
76
|
+
/** Described whether multi factor authentication is enabled for the user */
|
|
77
|
+
mfa_enabled?: boolean;
|
|
78
|
+
/** List of roles of a user */
|
|
79
|
+
roles?: string[];
|
|
80
|
+
/** List of groups of a user */
|
|
81
|
+
groups?: UserGroupMap[];
|
|
82
|
+
/** DEPRECATED: use groups instead */
|
|
83
|
+
userGroups?: UserGroupMap[];
|
|
84
|
+
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
85
|
+
trackId?: string;
|
|
86
|
+
/** User information Json Object in String format */
|
|
87
|
+
rawJSON?: string;
|
|
88
|
+
/** Described whether password reset is needed */
|
|
89
|
+
need_reset_password?: boolean;
|
|
90
|
+
/** required if it's present in data for update. */
|
|
91
|
+
_id?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface UserAddress {
|
|
94
|
+
/** Address in custom format */
|
|
95
|
+
formatted?: string;
|
|
96
|
+
/** Street name and house number part of user address */
|
|
97
|
+
street_address?: string;
|
|
98
|
+
/** City part of user address */
|
|
99
|
+
locality?: string;
|
|
100
|
+
/** State part of user address */
|
|
101
|
+
region?: string;
|
|
102
|
+
/** Postcode part of user address */
|
|
103
|
+
postal_code?: string;
|
|
104
|
+
/** Country part of user address */
|
|
105
|
+
country?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface UserMobile {
|
|
108
|
+
/** Phone number as provided by caller or user */
|
|
109
|
+
given_phone?: string;
|
|
110
|
+
/** Phone number */
|
|
111
|
+
phone?: string;
|
|
112
|
+
/** country where phone number is registered */
|
|
113
|
+
country?: string;
|
|
114
|
+
/** International pre dial code */
|
|
115
|
+
dail_code?: string;
|
|
116
|
+
/** Type of carrier */
|
|
117
|
+
carrier_type?: string;
|
|
118
|
+
/** Name of carrier */
|
|
119
|
+
carrier_name?: string;
|
|
120
|
+
/** National phone number format */
|
|
121
|
+
national_format?: string;
|
|
122
|
+
/** International phone number format e.g. + dial number + phone number without leading 0 but with spaces */
|
|
123
|
+
international_format?: string;
|
|
124
|
+
/** E164 is a compact international format without any spaces */
|
|
125
|
+
E164_format?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface UserGroupMap {
|
|
128
|
+
/** Subject identifier */
|
|
129
|
+
sub: string;
|
|
130
|
+
/** Id of user group */
|
|
131
|
+
groupId: string;
|
|
132
|
+
/** List of user roles inside the user group */
|
|
133
|
+
roles: string[];
|
|
134
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { HTTPRequestHeader } from "../common/Common.model";
|
|
2
|
+
import { AcceptClaimConsentRequest, AcceptConsentRequest, AcceptScopeConsentRequest, GetConsentDetailsRequest, GetConsentVersionDetailsRequest, RevokeClaimConsentRequest } from "./ConsentService.model";
|
|
3
|
+
/**
|
|
4
|
+
* To get consent details , call **getConsentDetails()**.
|
|
5
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/858fbeb51c62b-find-consent-info for more details.
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* this.cidaas.getConsentDetails({
|
|
9
|
+
* consent_id: 'consent id',
|
|
10
|
+
* consent_version_id: 'consent version id',
|
|
11
|
+
* sub: 'masked sub'
|
|
12
|
+
* })
|
|
13
|
+
* .then(function (response) {
|
|
14
|
+
* // type your code here
|
|
15
|
+
* })
|
|
16
|
+
* .catch(function (ex) {
|
|
17
|
+
* // your failure code here
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function getConsentDetails(options: GetConsentDetailsRequest, headers?: HTTPRequestHeader): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* To accept consent, call **acceptConsent()**.
|
|
24
|
+
* @example
|
|
25
|
+
* ```js
|
|
26
|
+
* this.cidaas.acceptConsent({
|
|
27
|
+
* client_id: 'your client id',
|
|
28
|
+
* consent_id: 'consent id',
|
|
29
|
+
* consent_version: 'consent version id',
|
|
30
|
+
* sub: 'masked sub'
|
|
31
|
+
* }).then((response) => {
|
|
32
|
+
* // the response will give you details of accepted consent.
|
|
33
|
+
* }).catch((err) => {
|
|
34
|
+
* // your failure code here
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function acceptConsent(options: AcceptConsentRequest, headers?: HTTPRequestHeader): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* To get version details of consent, call **getConsentVersionDetails()**.
|
|
41
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/7e24ac2113315-get-consent-version-details for more details.
|
|
42
|
+
* @example
|
|
43
|
+
* ```js
|
|
44
|
+
* this.cidaas.getConsentVersionDetails({
|
|
45
|
+
* consentid: 'your consent id',
|
|
46
|
+
* locale: 'browser accept language or custom language',
|
|
47
|
+
* access_token: 'your access token',
|
|
48
|
+
* }).then((response) => {
|
|
49
|
+
* // type your code here
|
|
50
|
+
* }).catch((err) => {
|
|
51
|
+
* // your failure code here
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function getConsentVersionDetails(options: GetConsentVersionDetailsRequest, headers?: HTTPRequestHeader): Promise<any>;
|
|
56
|
+
/**
|
|
57
|
+
* To accept scope consent, call **acceptScopeConsent()**.
|
|
58
|
+
* @example
|
|
59
|
+
* ```js
|
|
60
|
+
* this.cidaas.acceptScopeConsent({
|
|
61
|
+
* client_id: 'your client id',
|
|
62
|
+
* sub: 'masked sub',
|
|
63
|
+
* scopes: [your scope consents]
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function acceptScopeConsent(options: AcceptScopeConsentRequest, headers?: HTTPRequestHeader): Promise<any>;
|
|
68
|
+
/**
|
|
69
|
+
* To accept claim consent, call **acceptClaimConsent()**.
|
|
70
|
+
* @example
|
|
71
|
+
* ```js
|
|
72
|
+
* this.cidaas.acceptClaimConsent({
|
|
73
|
+
* client_id: 'your client id',
|
|
74
|
+
* sub: 'masked sub',
|
|
75
|
+
* accepted_claims: [your claim consents]
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function acceptClaimConsent(options: AcceptClaimConsentRequest, headers?: HTTPRequestHeader): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* To revoke claim consent, call **revokeClaimConsent()**.
|
|
82
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9ae62e98842fe-revoke-user-consent-claim for more details.
|
|
83
|
+
* @example
|
|
84
|
+
* ```js
|
|
85
|
+
* this.cidaas.revokeClaimConsent({
|
|
86
|
+
* access_token: 'your access token',
|
|
87
|
+
* client_id: 'your client id',
|
|
88
|
+
* sub: 'masked sub'
|
|
89
|
+
* revoked_claims: [your claim consents]
|
|
90
|
+
* }).then((response) => {
|
|
91
|
+
* // the response will give you revoked claim consent.
|
|
92
|
+
* }).catch((err) => {
|
|
93
|
+
* // your failure code here
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function revokeClaimConsent(options: RevokeClaimConsentRequest): Promise<any>;
|