cidaas-javascript-sdk 4.3.2 → 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 +57 -5
- package/README.md +109 -94
- package/dist/authentication-service/AuthenticationService.d.ts +140 -0
- package/dist/authentication-service/AuthenticationService.js +210 -0
- package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
- package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
- package/dist/common/Common.model.d.ts +15 -19
- package/dist/common/Common.model.js +17 -17
- package/dist/common/ConfigUserProvider.d.ts +10 -0
- package/dist/common/ConfigUserProvider.js +28 -0
- package/dist/common/Helper.d.ts +7 -0
- package/dist/common/Helper.js +19 -0
- package/dist/common/User.model.d.ts +0 -4
- package/dist/consent-service/ConsentService.d.ts +99 -95
- package/dist/consent-service/ConsentService.js +125 -122
- package/dist/consent-service/ConsentService.model.d.ts +14 -16
- package/dist/device-service/DeviceService.d.ts +49 -0
- package/dist/device-service/DeviceService.js +79 -0
- package/dist/device-service/DeviceService.model.d.ts +6 -0
- package/dist/id-validation-service/IdValidationService.d.ts +28 -0
- package/dist/id-validation-service/IdValidationService.js +59 -0
- package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
- package/dist/id-validation-service/IdValidationService.model.js +2 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +35 -18
- package/dist/login-service/LoginService.d.ts +143 -141
- package/dist/login-service/LoginService.js +225 -234
- package/dist/login-service/LoginService.model.d.ts +9 -53
- 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 -217
- package/dist/verification-service/VerificationService.js +343 -281
- package/dist/verification-service/VerificationService.model.d.ts +18 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
# [5.0.0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v4.3.3...v5.0.0) (2024-12-19)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
* feat()!: upgrade to v5 ([e5ac651](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/e5ac65125adbacf1e38dd21af5aad7d000eeb5e3))
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* ### Changed
|
|
10
|
+
- **Breaking** Rework library to calls functions from various modules
|
|
11
|
+
- **Breaking** Rework renewToken() to store the newly generated token in user storage
|
|
12
|
+
- **Breaking** Move setAcceptLanguageHeader function to Helper class
|
|
13
|
+
- **Breaking** Rename getUserInfo() to getUserInfoFromStorage()
|
|
14
|
+
- **Breaking** Rename getAccessToken() to generateTokenFromCode()
|
|
15
|
+
- **Breaking** Standardize enums
|
|
16
|
+
- **Breaking** Use enum instead of string for some function parameter
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
- **Breaking** Removed silentSignin() & silentSignInCallback() function
|
|
20
|
+
- **Breaking** Removed popupSignInCallback() & popupSignOutCallback()function
|
|
21
|
+
- **Breaking** Removed logoutUser() function
|
|
22
|
+
- **Breaking** Removed validateAccessToken() function
|
|
23
|
+
- **Breaking** Removed createPreloginWebauth function
|
|
24
|
+
- **Breaking** Removed unused & deprecated function parameters
|
|
8
25
|
|
|
9
26
|
# Changelog
|
|
10
27
|
|
|
28
|
+
## V5.0.0
|
|
29
|
+
|
|
30
|
+
If you are upgrading from v4.x.x, please see [UPGRADING.md](UPGRADING_V5.md)
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- Fix vulnerabilities from `npm audit`
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- Add invokeIdValidationCase() function
|
|
37
|
+
- Add [documentation](https://cidaas.github.io/cidaas-javascript-sdk) generated by typedoc
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- Support tokens from predefined user storage
|
|
41
|
+
- Use latest version of oidc client ts library
|
|
42
|
+
- **Breaking** Rework library to calls functions from various modules
|
|
43
|
+
- **Breaking** Rework renewToken() to store the newly generated token in user storage
|
|
44
|
+
- **Breaking** Move setAcceptLanguageHeader function to Helper class
|
|
45
|
+
- **Breaking** Rename getUserInfo() to getUserInfoFromStorage()
|
|
46
|
+
- **Breaking** Rename getAccessToken() to generateTokenFromCode()
|
|
47
|
+
- **Breaking** Standardize enums
|
|
48
|
+
- **Breaking** Use enum instead of string for some function parameter
|
|
49
|
+
|
|
50
|
+
### Removed
|
|
51
|
+
- **Breaking** Removed silentSignin() & silentSignInCallback() function
|
|
52
|
+
- **Breaking** Removed popupSignInCallback() & popupSignOutCallback()function
|
|
53
|
+
- **Breaking** Removed logoutUser() function
|
|
54
|
+
- **Breaking** Removed validateAccessToken() function
|
|
55
|
+
- **Breaking** Removed createPreloginWebauth function
|
|
56
|
+
- **Breaking** Removed unused & deprecated function parameters
|
|
57
|
+
|
|
58
|
+
## V4.3.3
|
|
59
|
+
|
|
60
|
+
## Changed
|
|
61
|
+
- Update GetMFAListRequest to support more parameters
|
|
62
|
+
|
|
11
63
|
## V4.3.2
|
|
12
64
|
|
|
13
65
|
### Changed
|
|
@@ -106,7 +158,7 @@
|
|
|
106
158
|
|
|
107
159
|
## V4.0.0
|
|
108
160
|
|
|
109
|
-
If you are upgrading from v3.x.x, please see [
|
|
161
|
+
If you are upgrading from v3.x.x, please see [UPGRADING.md](UPGRADING_V4.md)
|
|
110
162
|
|
|
111
163
|
### Fixed
|
|
112
164
|
- fix vulnerabilities from `npm audit`
|
package/README.md
CHANGED
|
@@ -20,19 +20,11 @@ Please check the [Changelog](https://github.com/Cidaas/cidaas-sdk-javascript-v2/
|
|
|
20
20
|
## Table of Contents
|
|
21
21
|
|
|
22
22
|
<!--ts-->
|
|
23
|
+
* [Documentation](https://cidaas.github.io/cidaas-javascript-sdk)
|
|
23
24
|
* [Installation](#installation)
|
|
24
25
|
* [Initialisation](#initialisation)
|
|
25
26
|
* [Usage](#usage)
|
|
26
27
|
* [Functions Overview](#functions-overview)
|
|
27
|
-
<!--ts-->
|
|
28
|
-
* [Authentication Functions](#authentication-functions)
|
|
29
|
-
* [Login Management](#login-management)
|
|
30
|
-
* [User Management](#user-management)
|
|
31
|
-
* [Token Management](#token-management)
|
|
32
|
-
* [Verification Management](#verification-management)
|
|
33
|
-
* [Consent Management](#consent-management)
|
|
34
|
-
* [Other Functionality](#other-functionality)
|
|
35
|
-
<!--te-->
|
|
36
28
|
* [Possible Error](#possible-error)
|
|
37
29
|
|
|
38
30
|
### Installation
|
|
@@ -63,6 +55,8 @@ Cidaas options variable support every [OIDC Client UserManagerSettings Propertie
|
|
|
63
55
|
| redirect_uri | yes | URL to be redirected after successful login attempt. |
|
|
64
56
|
| post_logout_redirect_uri | no | URL to be redirected after successful logout attempt. |
|
|
65
57
|
| scope | no | the scope the application requires and requests from cidaas. The default value is 'openid' if no properties is being sent. |
|
|
58
|
+
| userStore | no | define where authenticated user information will be saved on the client application. The default value is session storage if no properties is being sent. |
|
|
59
|
+
| automaticSilentRenew | no | configure whether automatic token renewal will be activated. The default value is true. |
|
|
66
60
|
|
|
67
61
|
an example of Cidaas options variable looks like this:
|
|
68
62
|
|
|
@@ -76,126 +70,148 @@ const options = {
|
|
|
76
70
|
}
|
|
77
71
|
```
|
|
78
72
|
|
|
79
|
-
###
|
|
73
|
+
### Configure user storage (Optional)
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
The following storages are supported to store authenticated user information, such as tokens information & user profile:
|
|
76
|
+
* window.sessionStorage (default)
|
|
77
|
+
* window.localStorage
|
|
78
|
+
* InMemoryWebStorage (all Information will be cleared after browser refresh) in case user do not want to save token in window object
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
additionally, user can also define custom storage in the client side by implementing Storage class.
|
|
86
81
|
|
|
87
|
-
|
|
82
|
+
If there is no userStore properties being send in Cidaas options variable, it will use session storage by default.
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
In case local storage is prefered to be used, then Cidaas options can be modified as following:
|
|
90
85
|
|
|
91
86
|
```js
|
|
92
|
-
|
|
87
|
+
const options = {
|
|
88
|
+
authority: 'your domain base url',
|
|
89
|
+
...,
|
|
90
|
+
userStore: new WebStorageStateStore({ store: window.localStorage })
|
|
91
|
+
}
|
|
93
92
|
```
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
To complete the login process, call **logincallback()**.
|
|
94
|
+
In case custom solution for storing authenticated user information is being used, or saving the token in memory is preferred, you can configured userStore with InMemoryWebStorage. Authenticated user information will be cleared as soon as the page is refreshed afterwards.
|
|
98
95
|
|
|
99
96
|
```js
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
97
|
+
const options = {
|
|
98
|
+
authority: 'your domain base url',
|
|
99
|
+
...,
|
|
100
|
+
userStore: new WebStorageStateStore({ store: new InMemoryWebStorage()})
|
|
101
|
+
}
|
|
105
102
|
```
|
|
106
103
|
|
|
107
|
-
|
|
104
|
+
see [usage](#get-tokens-and-user-profile-information-from-user-storage) to get the stored informations from user storage.
|
|
108
105
|
|
|
109
|
-
|
|
106
|
+
### Configure automatic token renewal (Optional)
|
|
110
107
|
|
|
111
|
-
|
|
108
|
+
By default, The SDK will generate new tokens based on refresh token stored in user storage, one minute before the access token is expiring. To disable this behaviour, Cidaas options can be modified as following:
|
|
112
109
|
|
|
113
|
-
|
|
110
|
+
```js
|
|
111
|
+
const options = {
|
|
112
|
+
authority: 'your domain base url',
|
|
113
|
+
...,
|
|
114
|
+
automaticSilentRenew: false
|
|
115
|
+
}
|
|
116
|
+
```
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
### Initialise the cidaas sdk using the configured options mentioned above:
|
|
116
119
|
|
|
117
|
-
|
|
120
|
+
Cidaas ConfigUserProvider have to be initialise to be added to each of the modules as dependencies:
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
Example of Cidaas Service:
|
|
123
|
+
```js
|
|
124
|
+
export class CidaasService {
|
|
125
|
+
cidaasConfigUserProvider: ConfigUserProvider;
|
|
126
|
+
authenticationService: AuthenticationService;
|
|
127
|
+
verificationService: VerificationService;
|
|
128
|
+
options: OidcSettings = { ... };
|
|
129
|
+
|
|
130
|
+
constructor() {
|
|
131
|
+
// init ConfigUserProvider
|
|
132
|
+
this.cidaasConfigUserProvider = new ConfigUserProvider(this.options);
|
|
133
|
+
// init authentication module
|
|
134
|
+
this.authenticationService = new AuthenticationService(this.cidaasConfigUserProvider);
|
|
135
|
+
// init verification module
|
|
136
|
+
this.verificationService = new VerificationService(this.cidaasConfigUserProvider);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// get authentication module
|
|
140
|
+
getAuthentication() {
|
|
141
|
+
return this.authenticationService;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// get verification module
|
|
145
|
+
getVerificationService() {
|
|
146
|
+
return this.verificationService
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
124
150
|
|
|
125
|
-
|
|
151
|
+
Usage in Component:
|
|
152
|
+
```js
|
|
153
|
+
// inject cidaas service
|
|
154
|
+
constructor(private cidaasService: CidaasService, ...) {}
|
|
126
155
|
|
|
127
|
-
|
|
156
|
+
...
|
|
128
157
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
| 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
|
-
| 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 |
|
|
158
|
+
// init each of cidaas modules which are needed in the component
|
|
159
|
+
this.cidaasAuthenticationService = this.cidaasService.getAuthenticationService();
|
|
160
|
+
this.cidaasVerificationService = this.cidaasService.getVerificationService();
|
|
136
161
|
|
|
137
|
-
|
|
162
|
+
...
|
|
138
163
|
|
|
139
|
-
|
|
164
|
+
// call functions from each of the modules
|
|
165
|
+
this.cidaasAuthenticationService.loginCallback();
|
|
166
|
+
...
|
|
167
|
+
this.cidaasVerificationService.getMFAList(getMFAListOptions);
|
|
168
|
+
...
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Each of the functions and its module can be looked in the doc.
|
|
173
|
+
|
|
174
|
+
### Usage
|
|
140
175
|
|
|
141
|
-
|
|
142
|
-
|-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
143
|
-
| getRegistrationSetup, register, registerWithSocial | Registering a new user is possible by using classic registration (getting registration fields information & call register function) or by using social provider |
|
|
144
|
-
| getUserProfile, getInviteUserDetails, getCommunicationStatus, updateProfile, updateProfileImage, deleteUserAccount, userCheckExists | To maintain user, functions for getting user information by using cidaas internal api, updating user information, removing user, as well as check if user exist are supported |
|
|
145
|
-
| getUserInfo | The SDK could be used to get user information by using oidc client ts library |
|
|
146
|
-
| getUserActivities | In case user want to see the history of his activities, getUserActivities function is provided |
|
|
147
|
-
| initiateResetPassword, handleResetPassword, resetPassword | In case user want to reset password, password reset flow is supported. From initiating the reset password, handling the code or link which has been sent to predefined medium such as email, sms & ivr, and finishing up the reset password |
|
|
148
|
-
| changePassword | In case user want to change password, changePassword function is provided |
|
|
149
|
-
| registerDeduplication, deduplicationLogin, getDeduplicationDetails | In case a new user is registered with similiar information as existing user, deduplication could be activated to either proceed with the registration, or combine the user with an existing one |
|
|
150
|
-
| initiateLinkAccount, completeLinkAccount, unlinkAccount, getLinkedUsers | Linking und unlinking user account with another account, as well as getting linked user is supported |
|
|
176
|
+
#### Login With Browser
|
|
151
177
|
|
|
152
|
-
|
|
178
|
+
To login through cidaas sdk, call **loginWithBrowser()**. This will redirect you to the hosted login page.
|
|
153
179
|
|
|
154
|
-
|
|
180
|
+
```js
|
|
181
|
+
cidaasAuthenticationService.loginWithBrowser();
|
|
182
|
+
```
|
|
155
183
|
|
|
156
|
-
|
|
157
|
-
|--------------------------------------|-----------------------------------------------------------------------------------------------------|
|
|
158
|
-
| getAccessToken | The SDK facilitate login using PKCE flow by exchanging code after succesful login with access token |
|
|
159
|
-
| renewToken | Session renewal is possible by using refresh token |
|
|
160
|
-
| initiateDeviceCode, deviceCodeVerify | Device code flow is supported for authenticating user without user interaction possibilty in device |
|
|
161
|
-
| validateAccessToken | Token validation could be done by using introspection endpoint |
|
|
162
|
-
| offlineTokenCheck | To save API call, offline token check function could be used |
|
|
184
|
+
once login is successful, it will automatically redirects you to redirect_uri you have configured in cidaas options. You will get information such as code & state as redirect url parameter (query or fragment), which is needed to get access token.
|
|
163
185
|
|
|
164
|
-
|
|
186
|
+
To complete the login process, call **logincallback()**.
|
|
165
187
|
|
|
166
|
-
|
|
188
|
+
```js
|
|
189
|
+
cidaasAuthenticationService.loginCallback().then(function(response) {
|
|
190
|
+
// the response will give you login details.
|
|
191
|
+
}).catch(function(ex) {
|
|
192
|
+
// your failure code here
|
|
193
|
+
});
|
|
194
|
+
```
|
|
167
195
|
|
|
168
|
-
|
|
169
|
-
|---------------------------------------------------------------------|---------------------------------------------------------------------------------------|
|
|
170
|
-
| initiateMFA, authenticateMFA | The SDK support initiating & authenticating MFA, which starts passwordless login flow |
|
|
171
|
-
| initiateAccountVerification, verifyAccount | User account verification using preconfigured MFA is supported |
|
|
172
|
-
| cancelMFA | MFA process could be aborted in case something go the wrong way |
|
|
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 |
|
|
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 |
|
|
196
|
+
After successful loginCallback, You will get access token, along with id token and refresh token in the json response, depends on your application configuration.
|
|
176
197
|
|
|
177
|
-
|
|
198
|
+
There are code documentations for each of the functions with example code of how to call them individually.
|
|
178
199
|
|
|
179
|
-
|
|
200
|
+
#### Get Tokens And User Profile Information From User Storage
|
|
180
201
|
|
|
181
|
-
|
|
182
|
-
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
|
|
183
|
-
| getConsentDetails, getConsentVersionDetails | The SDK could be used to get consent details as well as details of consent's version |
|
|
184
|
-
| acceptConsent, acceptScopeConsent, acceptClaimConsent, revokeClaimConsent | The SDK support accepting consent (app level consent, scope consent or claim consent) as well as revoke claim consent |
|
|
202
|
+
To get information from user storage, call **getUserInfoFromStorage()**. This function will fetch stored information from predefined user storage (session storage, local storage or in memory)
|
|
185
203
|
|
|
186
|
-
|
|
204
|
+
```js
|
|
205
|
+
cidaasAuthenticationService.getUserInfoFromStorage().then(function(response) {
|
|
206
|
+
// the response will contains tokens & user profile information.
|
|
207
|
+
}).catch(function(ex) {
|
|
208
|
+
// your failure code here
|
|
209
|
+
});
|
|
210
|
+
```
|
|
187
211
|
|
|
188
|
-
|
|
212
|
+
### Functions Overview
|
|
189
213
|
|
|
190
|
-
|
|
191
|
-
|------------------------------------------------|---------------------------------------------------------------------------------------------|
|
|
192
|
-
| getRequestId | The SDK could be used to get request id, which is required as input to call other functions |
|
|
193
|
-
| getLoginURL | Getting login authz url is supported by the SDK |
|
|
194
|
-
| getTenantInfo, getClientInfo | Getting public information such as tenant info & client info is supported by the SDK |
|
|
195
|
-
| setAcceptLanguageHeader | The SDK could be used to change response language |
|
|
196
|
-
| createDeviceInfo, getDevicesInfo, deleteDevice | Creating, getting, and removing device information is supported by the SDK |
|
|
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 |
|
|
214
|
+
Cidaas Javascript SDK Functions can be found on the [documentation](https://cidaas.github.io/cidaas-javascript-sdk).
|
|
199
215
|
|
|
200
216
|
## Possible Error
|
|
201
217
|
|
|
@@ -205,4 +221,3 @@ The SDK will throws Custom Exception if something went wrong during the operatio
|
|
|
205
221
|
|----------------- | ----------------------- |
|
|
206
222
|
| 500 | during creation of WebAuth instance |
|
|
207
223
|
| 417 | if there are any other failure |
|
|
208
|
-
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import ConfigUserProvider from '../common/ConfigUserProvider';
|
|
2
|
+
import { OidcManager, OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, RenewTokenOptions, User, LogoutResponse, LoginRequestOptions } from './AuthenticationService.model';
|
|
3
|
+
export declare class AuthenticationService {
|
|
4
|
+
userManager: OidcManager;
|
|
5
|
+
config: OidcSettings;
|
|
6
|
+
configUserProvider: ConfigUserProvider;
|
|
7
|
+
constructor(configUserProvider: ConfigUserProvider);
|
|
8
|
+
/**
|
|
9
|
+
* To register through cidaas sdk, call **registerWithBrowser()**. This will generate and redirect the app to authz url in same window for register view.
|
|
10
|
+
* Afterwards you will be redirected to the hosted registration page.
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* cidaasAuthenticationService.registerWithBrowser();
|
|
14
|
+
* ```
|
|
15
|
+
* @param {LoginRedirectOptions} options to over-ride the client config for redirect login
|
|
16
|
+
*/
|
|
17
|
+
registerWithBrowser(options?: LoginRedirectOptions): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* 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.
|
|
20
|
+
* Once login successful, it will automatically redirects you to the redirect url, which is configured in cidaas config.
|
|
21
|
+
* @example
|
|
22
|
+
* ```js
|
|
23
|
+
* cidaasAuthenticationService.loginWithBrowser();
|
|
24
|
+
* ```
|
|
25
|
+
* @param {LoginRedirectOptions} options to over-ride the client config for redirect login
|
|
26
|
+
*/
|
|
27
|
+
loginWithBrowser(options?: LoginRedirectOptions): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* To open the hosted login page in pop up window, call **popupSignIn()**. This will generate and open authz url in a popup window.
|
|
30
|
+
* On successful sign in, authenticated user is returned.
|
|
31
|
+
* @example
|
|
32
|
+
* ```js
|
|
33
|
+
* cidaasAuthenticationService.popupSignIn().then(function (response) {
|
|
34
|
+
* // the response will give you user details after finishing loginCallback().
|
|
35
|
+
* }).catch(function(ex) {
|
|
36
|
+
* // your failure code here
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
* @param {PopupSignInOptions} options optional options to over-ride the client config for popup sign in
|
|
40
|
+
*/
|
|
41
|
+
popupSignIn(options?: PopupSignInOptions): Promise<User>;
|
|
42
|
+
/**
|
|
43
|
+
* Once login successful, it will automatically redirects you to the redirect url, which is configured in cidaas config.
|
|
44
|
+
* To complete the login process, call **loginCallback()**. This will parses needed informations such as tokens in the redirect url.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```js
|
|
48
|
+
* cidaasAuthenticationService.loginCallback().then(function (response: User) {
|
|
49
|
+
* // the response will give you login details.
|
|
50
|
+
* }).catch(function(ex) {
|
|
51
|
+
* // your failure code here
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
* @param {string} url optional url to read sign in state from
|
|
55
|
+
*/
|
|
56
|
+
loginCallback(url?: string): Promise<import("oidc-client-ts").User>;
|
|
57
|
+
/**
|
|
58
|
+
* To end user session, call **logout()**. You need set the redirect url, if not it will automatically redirect to the login page
|
|
59
|
+
* @example
|
|
60
|
+
* ```js
|
|
61
|
+
* cidaasAuthenticationService.logout();
|
|
62
|
+
* ```
|
|
63
|
+
* @param {LogoutRedirectOptions} options optional logout options to override cidaas configuration
|
|
64
|
+
*/
|
|
65
|
+
logout(options?: LogoutRedirectOptions): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* To open the hosted logout page in pop up window, call **popupSignOut()**.
|
|
68
|
+
* @example
|
|
69
|
+
* ```js
|
|
70
|
+
* cidaasAuthenticationService.popupSignOut().then(function() {
|
|
71
|
+
* // success callback in main application window after finishing popupSignOutCallback().
|
|
72
|
+
* }).catch(function(ex) {
|
|
73
|
+
* // your failure code here
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param {PopupSignOutOptions} options optional logout options to override cidaas configuration
|
|
78
|
+
*/
|
|
79
|
+
popupSignOut(options?: PopupSignOutOptions): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* **logoutCallback()** will parses the details of userState after logout.
|
|
82
|
+
* Get the logout call state from the url provided, if none is provided current window url is used.
|
|
83
|
+
* @example
|
|
84
|
+
* ```js
|
|
85
|
+
* cidaasAuthenticationService.logoutCallback().then(function (response: LogoutResponse) {
|
|
86
|
+
* // the response will give you userState details.
|
|
87
|
+
* }).catch(function(ex) {
|
|
88
|
+
* // your failure code here
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
* @param {string} url optional url to read signout state from,
|
|
92
|
+
* @param {boolean} keepopen optional boolean to keep the popup window open after logout, in case of popupSignOut()
|
|
93
|
+
*/
|
|
94
|
+
logoutCallback(url?: string, keepopen?: boolean): Promise<LogoutResponse | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* **renewToken()** will update user information in user storage with a new token, based on refresh token that is stored in the storage.
|
|
97
|
+
* On successful token renewal, authenticated user is returned
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```js
|
|
101
|
+
* cidaasAuthenticationService.renewToken().then(function (response) {
|
|
102
|
+
* // the response will give you user details.
|
|
103
|
+
* }).catch(function(ex) {
|
|
104
|
+
* // your failure code here
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
* @param {RenewTokenOptions} options options to over-ride the client config for renewing token.
|
|
108
|
+
* @returns {Promise<User>} Authenticated user
|
|
109
|
+
*/
|
|
110
|
+
renewToken(options?: RenewTokenOptions): Promise<User>;
|
|
111
|
+
/**
|
|
112
|
+
* To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
|
|
113
|
+
* @example
|
|
114
|
+
* ```js
|
|
115
|
+
* cidaasAuthenticationService.getLoginURL().then(function (response) {
|
|
116
|
+
* // the response will give you login url.
|
|
117
|
+
* }).catch(function(ex) {
|
|
118
|
+
* // your failure code here
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
* @param {LoginRequestOptions} options login options to override config settings provided
|
|
122
|
+
* @return {Promise<string>} authz url for login
|
|
123
|
+
*/
|
|
124
|
+
getLoginURL(options?: LoginRequestOptions): Promise<string>;
|
|
125
|
+
/**
|
|
126
|
+
* To get the user informations from defined UserStorage, call **getUserInfoFromStorage()**.
|
|
127
|
+
* 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)
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```js
|
|
131
|
+
* cidaasAuthenticationService.getUserInfoFromStorage().then(function (response) {
|
|
132
|
+
* // the response will give you profile details.
|
|
133
|
+
* }).catch(function(ex) {
|
|
134
|
+
* // your failure code here
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
* @return {Promise<User|null>} returns authenticated user if present, else null
|
|
138
|
+
*/
|
|
139
|
+
getUserInfoFromStorage(): Promise<User | null>;
|
|
140
|
+
}
|