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
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuthenticationService = void 0;
|
|
13
|
+
const Helper_1 = require("../common/Helper");
|
|
14
|
+
class AuthenticationService {
|
|
15
|
+
constructor(configUserProvider) {
|
|
16
|
+
if (!configUserProvider || !configUserProvider.getConfig()) {
|
|
17
|
+
throw new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
|
|
18
|
+
}
|
|
19
|
+
this.config = configUserProvider.getConfig();
|
|
20
|
+
this.userManager = configUserProvider.getUserManager();
|
|
21
|
+
this.userManager.events.addSilentRenewError(function () {
|
|
22
|
+
throw new Helper_1.CustomException("Error while renewing silent login", 500);
|
|
23
|
+
});
|
|
24
|
+
this.configUserProvider = configUserProvider;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* To register through cidaas sdk, call **registerWithBrowser()**. This will generate and redirect the app to authz url in same window for register view.
|
|
28
|
+
* Afterwards you will be redirected to the hosted registration page.
|
|
29
|
+
* @example
|
|
30
|
+
* ```js
|
|
31
|
+
* cidaasAuthenticationService.registerWithBrowser();
|
|
32
|
+
* ```
|
|
33
|
+
* @param {LoginRedirectOptions} options to over-ride the client config for redirect login
|
|
34
|
+
*/
|
|
35
|
+
registerWithBrowser(options) {
|
|
36
|
+
return loginOrRegisterWithBrowser(this.configUserProvider, 'register', options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* To login through cidaas sdk, call **loginWithBrowser()**. This will generate and redirect the app to authz url in same window for logging in. Afterwards you will be redirected to the hosted login page.
|
|
40
|
+
* Once login successful, it will automatically redirects you to the redirect url, which is configured in cidaas config.
|
|
41
|
+
* @example
|
|
42
|
+
* ```js
|
|
43
|
+
* cidaasAuthenticationService.loginWithBrowser();
|
|
44
|
+
* ```
|
|
45
|
+
* @param {LoginRedirectOptions} options to over-ride the client config for redirect login
|
|
46
|
+
*/
|
|
47
|
+
loginWithBrowser(options) {
|
|
48
|
+
return loginOrRegisterWithBrowser(this.configUserProvider, 'login', options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* To open the hosted login page in pop up window, call **popupSignIn()**. This will generate and open authz url in a popup window.
|
|
52
|
+
* On successful sign in, authenticated user is returned.
|
|
53
|
+
* @example
|
|
54
|
+
* ```js
|
|
55
|
+
* cidaasAuthenticationService.popupSignIn().then(function (response) {
|
|
56
|
+
* // the response will give you user details after finishing loginCallback().
|
|
57
|
+
* }).catch(function(ex) {
|
|
58
|
+
* // your failure code here
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
* @param {PopupSignInOptions} options optional options to over-ride the client config for popup sign in
|
|
62
|
+
*/
|
|
63
|
+
popupSignIn(options) {
|
|
64
|
+
return this.userManager.signinPopup(options);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Once login successful, it will automatically redirects you to the redirect url, which is configured in cidaas config.
|
|
68
|
+
* To complete the login process, call **loginCallback()**. This will parses needed informations such as tokens in the redirect url.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```js
|
|
72
|
+
* cidaasAuthenticationService.loginCallback().then(function (response: User) {
|
|
73
|
+
* // the response will give you login details.
|
|
74
|
+
* }).catch(function(ex) {
|
|
75
|
+
* // your failure code here
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
* @param {string} url optional url to read sign in state from
|
|
79
|
+
*/
|
|
80
|
+
loginCallback(url) {
|
|
81
|
+
return this.userManager.signinCallback(url);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* To end user session, call **logout()**. You need set the redirect url, if not it will automatically redirect to the login page
|
|
85
|
+
* @example
|
|
86
|
+
* ```js
|
|
87
|
+
* cidaasAuthenticationService.logout();
|
|
88
|
+
* ```
|
|
89
|
+
* @param {LogoutRedirectOptions} options optional logout options to override cidaas configuration
|
|
90
|
+
*/
|
|
91
|
+
logout(options) {
|
|
92
|
+
return this.userManager.signoutRedirect(options);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* To open the hosted logout page in pop up window, call **popupSignOut()**.
|
|
96
|
+
* @example
|
|
97
|
+
* ```js
|
|
98
|
+
* cidaasAuthenticationService.popupSignOut().then(function() {
|
|
99
|
+
* // success callback in main application window after finishing popupSignOutCallback().
|
|
100
|
+
* }).catch(function(ex) {
|
|
101
|
+
* // your failure code here
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param {PopupSignOutOptions} options optional logout options to override cidaas configuration
|
|
106
|
+
*/
|
|
107
|
+
popupSignOut(options) {
|
|
108
|
+
return this.userManager.signoutPopup(options);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* **logoutCallback()** will parses the details of userState after logout.
|
|
112
|
+
* Get the logout call state from the url provided, if none is provided current window url is used.
|
|
113
|
+
* @example
|
|
114
|
+
* ```js
|
|
115
|
+
* cidaasAuthenticationService.logoutCallback().then(function (response: LogoutResponse) {
|
|
116
|
+
* // the response will give you userState details.
|
|
117
|
+
* }).catch(function(ex) {
|
|
118
|
+
* // your failure code here
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
* @param {string} url optional url to read signout state from,
|
|
122
|
+
* @param {boolean} keepopen optional boolean to keep the popup window open after logout, in case of popupSignOut()
|
|
123
|
+
*/
|
|
124
|
+
logoutCallback(url, keepopen) {
|
|
125
|
+
return this.userManager.signoutCallback(url, keepopen);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* **renewToken()** will update user information in user storage with a new token, based on refresh token that is stored in the storage.
|
|
129
|
+
* On successful token renewal, authenticated user is returned
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```js
|
|
133
|
+
* cidaasAuthenticationService.renewToken().then(function (response) {
|
|
134
|
+
* // the response will give you user details.
|
|
135
|
+
* }).catch(function(ex) {
|
|
136
|
+
* // your failure code here
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
* @param {RenewTokenOptions} options options to over-ride the client config for renewing token.
|
|
140
|
+
* @returns {Promise<User>} Authenticated user
|
|
141
|
+
*/
|
|
142
|
+
renewToken(options) {
|
|
143
|
+
return this.userManager.signinSilent(Object.assign({ silentRequestTimeoutInSeconds: 60 }, (options && Object.assign({}, options) || {})));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
|
|
147
|
+
* @example
|
|
148
|
+
* ```js
|
|
149
|
+
* cidaasAuthenticationService.getLoginURL().then(function (response) {
|
|
150
|
+
* // the response will give you login url.
|
|
151
|
+
* }).catch(function(ex) {
|
|
152
|
+
* // your failure code here
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
* @param {LoginRequestOptions} options login options to override config settings provided
|
|
156
|
+
* @return {Promise<string>} authz url for login
|
|
157
|
+
*/
|
|
158
|
+
getLoginURL(options) {
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
this.userManager.getClient().createSigninRequest(Object.assign(Object.assign({}, this.config), (options && { options } || {}))).then((signinRequest) => {
|
|
161
|
+
resolve(signinRequest.url);
|
|
162
|
+
}).catch((e) => {
|
|
163
|
+
reject(e);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* To get the user informations from defined UserStorage, call **getUserInfoFromStorage()**.
|
|
169
|
+
* This will fetch informations about the authenticated user such as tokens & user profiles, which has been stored in predefined user storage based on cidaas configuration. (default is session storage)
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```js
|
|
173
|
+
* cidaasAuthenticationService.getUserInfoFromStorage().then(function (response) {
|
|
174
|
+
* // the response will give you profile details.
|
|
175
|
+
* }).catch(function(ex) {
|
|
176
|
+
* // your failure code here
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
* @return {Promise<User|null>} returns authenticated user if present, else null
|
|
180
|
+
*/
|
|
181
|
+
getUserInfoFromStorage() {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (!this.userManager) {
|
|
184
|
+
return Promise.reject(new Helper_1.CustomException("UserManager cannot be empty", 417));
|
|
185
|
+
}
|
|
186
|
+
return yield this.userManager.getUser();
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.AuthenticationService = AuthenticationService;
|
|
191
|
+
/**
|
|
192
|
+
* This function will be called internally by loginWithBrowser() & registerWithBrowser function, to either authenticate existing user or register a new one.
|
|
193
|
+
*
|
|
194
|
+
* @param {ConfigUserProvider} configUserProvider contains cidaas configuration and user manager
|
|
195
|
+
* @param {string} view_type either 'login' or 'register'
|
|
196
|
+
* @param {LoginRedirectOptions} options optional login options to override the webauth configuration
|
|
197
|
+
*/
|
|
198
|
+
function loginOrRegisterWithBrowser(configUserProvider, view_type, options) {
|
|
199
|
+
var _a;
|
|
200
|
+
const config = configUserProvider.getConfig();
|
|
201
|
+
if (!config.extraQueryParams) {
|
|
202
|
+
config.extraQueryParams = {};
|
|
203
|
+
}
|
|
204
|
+
config.extraQueryParams.view_type = view_type;
|
|
205
|
+
if (config.response_type.indexOf("id_token") == -1 && ((_a = config.scope) === null || _a === void 0 ? void 0 : _a.indexOf("openid")) != -1 && !config.extraQueryParams.nonce) {
|
|
206
|
+
config.extraQueryParams.nonce = new Date().getTime().toString();
|
|
207
|
+
}
|
|
208
|
+
const userManager = configUserProvider.getUserManager();
|
|
209
|
+
return userManager.signinRedirect(Object.assign({ extraQueryParams: config.extraQueryParams, redirect_uri: config.redirect_uri }, (options && Object.assign({}, options) || {})));
|
|
210
|
+
}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import { SigninPopupArgs, SigninRedirectArgs, SigninSilentArgs, SignoutPopupArgs, SignoutRedirectArgs, UserManagerSettings, UserManager, OidcClient, CreateSigninRequestArgs, User as OidcUser, SignoutResponse } from 'oidc-client-ts';
|
|
1
|
+
import { SigninPopupArgs, SigninRedirectArgs, SigninSilentArgs, SignoutPopupArgs, SignoutRedirectArgs, UserManagerSettings, UserManager, OidcClient, CreateSigninRequestArgs, User as OidcUser, SignoutResponse, SigninRequest } from 'oidc-client-ts';
|
|
2
2
|
/**
|
|
3
3
|
* @augments UserManagerSettings
|
|
4
|
-
|
|
4
|
+
*/
|
|
5
5
|
export interface OidcSettings extends UserManagerSettings {
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* @augments UserManager
|
|
9
|
-
|
|
9
|
+
*/
|
|
10
10
|
export declare class OidcManager extends UserManager {
|
|
11
11
|
constructor(settings: OidcSettings);
|
|
12
12
|
getClient(): OidcClient;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
15
|
* Login request to generate authz url.
|
|
16
|
+
* @augments SigninRequest
|
|
17
|
+
*/
|
|
18
|
+
export interface LoginRequest extends SigninRequest {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* options for Login request to generate authz url.
|
|
16
22
|
* It's based of the parameters in OIDC specs
|
|
17
23
|
* @augments CreateSigninRequestArgs
|
|
18
24
|
*/
|
|
19
25
|
export interface LoginRequestOptions extends CreateSigninRequestArgs {
|
|
20
26
|
}
|
|
21
|
-
|
|
27
|
+
/**
|
|
22
28
|
* Options to override options during redirect login
|
|
23
29
|
* @augments SigninRedirectArgs
|
|
24
30
|
*/
|
|
@@ -27,36 +33,36 @@ export interface LoginRedirectOptions extends SigninRedirectArgs {
|
|
|
27
33
|
/**
|
|
28
34
|
* Response state holding sign out errors if any
|
|
29
35
|
* @augments SignoutResponse
|
|
30
|
-
|
|
36
|
+
*/
|
|
31
37
|
export interface LogoutResponse extends SignoutResponse {
|
|
32
38
|
}
|
|
33
|
-
|
|
39
|
+
/**
|
|
34
40
|
* Options to override options during redirect logout
|
|
35
41
|
* @augments SignoutRedirectArgs
|
|
36
42
|
*/
|
|
37
43
|
export interface LogoutRedirectOptions extends SignoutRedirectArgs {
|
|
38
44
|
}
|
|
39
|
-
|
|
45
|
+
/**
|
|
40
46
|
* Options to override options during popup sign in
|
|
41
47
|
* @augments SigninPopupArgs
|
|
42
48
|
*/
|
|
43
49
|
export interface PopupSignInOptions extends SigninPopupArgs {
|
|
44
50
|
}
|
|
45
|
-
|
|
51
|
+
/**
|
|
46
52
|
* Options to override options during popup sign out
|
|
47
53
|
* @augments SignoutPopupArgs
|
|
48
54
|
*/
|
|
49
55
|
export interface PopupSignOutOptions extends SignoutPopupArgs {
|
|
50
56
|
}
|
|
51
|
-
|
|
57
|
+
/**
|
|
52
58
|
* Options to override options during silent sign in
|
|
53
59
|
* @augments SigninSilentArgs
|
|
54
60
|
*/
|
|
55
|
-
export interface
|
|
61
|
+
export interface RenewTokenOptions extends SigninSilentArgs {
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* Authenticated user information including token, id_token and claims
|
|
59
65
|
* @augments OidcUser
|
|
60
|
-
|
|
66
|
+
*/
|
|
61
67
|
export declare class User extends OidcUser {
|
|
62
68
|
}
|
|
@@ -4,7 +4,7 @@ exports.User = exports.OidcManager = void 0;
|
|
|
4
4
|
const oidc_client_ts_1 = require("oidc-client-ts");
|
|
5
5
|
/**
|
|
6
6
|
* @augments UserManager
|
|
7
|
-
|
|
7
|
+
*/
|
|
8
8
|
class OidcManager extends oidc_client_ts_1.UserManager {
|
|
9
9
|
constructor(settings) {
|
|
10
10
|
super(settings);
|
|
@@ -17,7 +17,7 @@ exports.OidcManager = OidcManager;
|
|
|
17
17
|
/**
|
|
18
18
|
* Authenticated user information including token, id_token and claims
|
|
19
19
|
* @augments OidcUser
|
|
20
|
-
|
|
20
|
+
*/
|
|
21
21
|
class User extends oidc_client_ts_1.User {
|
|
22
22
|
}
|
|
23
23
|
exports.User = User;
|
|
@@ -4,29 +4,25 @@ export interface LoginPrecheckRequest {
|
|
|
4
4
|
}
|
|
5
5
|
/** Type of verification to be used to authenticate user */
|
|
6
6
|
export declare enum VerificationType {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
Password = "PASSWORD",
|
|
8
|
+
TouchId = "TOUCHID",
|
|
9
|
+
Fido2 = "FIDO2",
|
|
10
|
+
SecurityQuestion = "SECURITY_QUESTION",
|
|
11
|
+
Sms = "SMS",
|
|
12
|
+
Ivr = "IVR",
|
|
13
|
+
Face = "FACE",
|
|
14
|
+
Totp = "TOTP",
|
|
15
|
+
Email = "EMAIL",
|
|
16
|
+
BackupCode = "BACKUPCODE",
|
|
17
|
+
Pattern = "PATTERN",
|
|
18
|
+
Push = "PUSH",
|
|
19
|
+
Voice = "VOICE"
|
|
20
20
|
}
|
|
21
21
|
export interface HTTPRequestHeader {
|
|
22
22
|
/** Request id returned from the authorization call */
|
|
23
23
|
requestId: string;
|
|
24
|
-
/** DEPRECATED: Captcha string for captcha check */
|
|
25
|
-
captcha?: string;
|
|
26
24
|
/** Response language, which is configured in cidaas admin ui */
|
|
27
25
|
acceptlanguage?: string;
|
|
28
|
-
/** DEPRECATED: Needed in case bot captcha check is activated */
|
|
29
|
-
bot_captcha_response?: string;
|
|
30
26
|
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
31
27
|
trackId?: string;
|
|
32
28
|
/** Latitude is the string location parameter sent in the headers */
|
|
@@ -36,6 +32,6 @@ export interface HTTPRequestHeader {
|
|
|
36
32
|
}
|
|
37
33
|
/** 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
34
|
export declare enum ProcessingType {
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
Code = "CODE",
|
|
36
|
+
Link = "LINK"
|
|
41
37
|
}
|
|
@@ -4,23 +4,23 @@ exports.ProcessingType = exports.VerificationType = void 0;
|
|
|
4
4
|
/** Type of verification to be used to authenticate user */
|
|
5
5
|
var VerificationType;
|
|
6
6
|
(function (VerificationType) {
|
|
7
|
-
VerificationType[
|
|
8
|
-
VerificationType[
|
|
9
|
-
VerificationType[
|
|
10
|
-
VerificationType[
|
|
11
|
-
VerificationType[
|
|
12
|
-
VerificationType[
|
|
13
|
-
VerificationType[
|
|
14
|
-
VerificationType[
|
|
15
|
-
VerificationType[
|
|
16
|
-
VerificationType[
|
|
17
|
-
VerificationType[
|
|
18
|
-
VerificationType[
|
|
19
|
-
VerificationType[
|
|
20
|
-
})(VerificationType
|
|
7
|
+
VerificationType["Password"] = "PASSWORD";
|
|
8
|
+
VerificationType["TouchId"] = "TOUCHID";
|
|
9
|
+
VerificationType["Fido2"] = "FIDO2";
|
|
10
|
+
VerificationType["SecurityQuestion"] = "SECURITY_QUESTION";
|
|
11
|
+
VerificationType["Sms"] = "SMS";
|
|
12
|
+
VerificationType["Ivr"] = "IVR";
|
|
13
|
+
VerificationType["Face"] = "FACE";
|
|
14
|
+
VerificationType["Totp"] = "TOTP";
|
|
15
|
+
VerificationType["Email"] = "EMAIL";
|
|
16
|
+
VerificationType["BackupCode"] = "BACKUPCODE";
|
|
17
|
+
VerificationType["Pattern"] = "PATTERN";
|
|
18
|
+
VerificationType["Push"] = "PUSH";
|
|
19
|
+
VerificationType["Voice"] = "VOICE";
|
|
20
|
+
})(VerificationType || (exports.VerificationType = VerificationType = {}));
|
|
21
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
22
|
var ProcessingType;
|
|
23
23
|
(function (ProcessingType) {
|
|
24
|
-
ProcessingType[
|
|
25
|
-
ProcessingType[
|
|
26
|
-
})(ProcessingType
|
|
24
|
+
ProcessingType["Code"] = "CODE";
|
|
25
|
+
ProcessingType["Link"] = "LINK";
|
|
26
|
+
})(ProcessingType || (exports.ProcessingType = ProcessingType = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OidcManager, OidcSettings } from "../authentication-service/AuthenticationService.model";
|
|
2
|
+
declare class ConfigUserProvider {
|
|
3
|
+
private config;
|
|
4
|
+
private userManager;
|
|
5
|
+
constructor(config: OidcSettings);
|
|
6
|
+
setConfig(config: OidcSettings): void;
|
|
7
|
+
getConfig(): OidcSettings;
|
|
8
|
+
getUserManager(): OidcManager;
|
|
9
|
+
}
|
|
10
|
+
export default ConfigUserProvider;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AuthenticationService_model_1 = require("../authentication-service/AuthenticationService.model");
|
|
4
|
+
class ConfigUserProvider {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
if (!config.response_type) {
|
|
7
|
+
config.response_type = "code";
|
|
8
|
+
}
|
|
9
|
+
if (!config.scope) {
|
|
10
|
+
config.scope = "email openid profile mobile";
|
|
11
|
+
}
|
|
12
|
+
if (config.authority && config.authority.charAt(config.authority.length - 1) === '/') {
|
|
13
|
+
config.authority = config.authority.slice(0, config.authority.length - 1);
|
|
14
|
+
}
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.userManager = new AuthenticationService_model_1.OidcManager(this.config);
|
|
17
|
+
}
|
|
18
|
+
setConfig(config) {
|
|
19
|
+
this.config = Object.assign(Object.assign({}, this.config), config);
|
|
20
|
+
}
|
|
21
|
+
getConfig() {
|
|
22
|
+
return this.config;
|
|
23
|
+
}
|
|
24
|
+
getUserManager() {
|
|
25
|
+
return this.userManager;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = ConfigUserProvider;
|
package/dist/common/Helper.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OidcManager } from "../authentication-service/AuthenticationService.model";
|
|
1
2
|
export declare class Helper {
|
|
2
3
|
/**
|
|
3
4
|
* create form
|
|
@@ -16,6 +17,12 @@ export declare class Helper {
|
|
|
16
17
|
* @returns
|
|
17
18
|
*/
|
|
18
19
|
static createHttpPromise(options: any, serviceurl: string, errorResolver: boolean, method: string, access_token?: string, headers?: any, formPayload?: FormData): Promise<any>;
|
|
20
|
+
static getAccessTokenFromUserStorage(userManager: OidcManager): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* To set accept language
|
|
23
|
+
* @param acceptLanguage
|
|
24
|
+
*/
|
|
25
|
+
static setAcceptLanguageHeader(acceptLanguage: string): void;
|
|
19
26
|
}
|
|
20
27
|
export declare class CustomException {
|
|
21
28
|
errorMessage: string;
|
package/dist/common/Helper.js
CHANGED
|
@@ -88,6 +88,25 @@ class Helper {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
static getAccessTokenFromUserStorage(userManager) {
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
try {
|
|
94
|
+
userManager.getUser().then((user) => {
|
|
95
|
+
resolve(user === null || user === void 0 ? void 0 : user.access_token);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (ex) {
|
|
99
|
+
reject(ex);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* To set accept language
|
|
105
|
+
* @param acceptLanguage
|
|
106
|
+
*/
|
|
107
|
+
static setAcceptLanguageHeader(acceptLanguage) {
|
|
108
|
+
window.localeSettings = acceptLanguage;
|
|
109
|
+
}
|
|
91
110
|
}
|
|
92
111
|
exports.Helper = Helper;
|
|
93
112
|
class CustomException {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export interface CidaasUser {
|
|
2
2
|
/** Status of User */
|
|
3
3
|
userStatus?: string;
|
|
4
|
-
/** DEPRECATED: use userStatus variable instead */
|
|
5
|
-
user_status?: string;
|
|
6
4
|
/** Reason for user status */
|
|
7
5
|
user_status_reason?: string;
|
|
8
6
|
/** Username of the user */
|
|
@@ -79,8 +77,6 @@ export interface CidaasUser {
|
|
|
79
77
|
roles?: string[];
|
|
80
78
|
/** List of groups of a user */
|
|
81
79
|
groups?: UserGroupMap[];
|
|
82
|
-
/** DEPRECATED: use groups instead */
|
|
83
|
-
userGroups?: UserGroupMap[];
|
|
84
80
|
/** Identifier generated after successful authentication but unfulfilled prechecks */
|
|
85
81
|
trackId?: string;
|
|
86
82
|
/** User information Json Object in String format */
|