cidaas-javascript-sdk 4.1.0 → 4.2.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 +35 -9
- package/dist/authentication/authentication.model.d.ts +61 -0
- package/dist/authentication/authentication.model.js +45 -0
- package/dist/authentication/index.d.ts +47 -27
- package/dist/authentication/index.js +85 -204
- package/dist/web-auth/LoginService.js +0 -1
- package/dist/web-auth/TokenService.js +1 -1
- package/dist/web-auth/WebAuth.d.ts +79 -39
- package/dist/web-auth/WebAuth.js +136 -182
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
## [4.2.1](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v4.2.0...v4.2.1) (2024-04-05)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([ffc503d](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/ffc503dfde2510c8000e18cb437b5ab0a7578ee8))
|
|
8
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([a3d2860](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/a3d28601490b0303c9f86b60aeda3c5a46788966))
|
|
9
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([88cd3b7](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/88cd3b766de7ede953594cc47d34d6e45dc3e17b))
|
|
10
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([1c347ef](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/1c347efc9a54d787538416b3eee1d609238b4b1d))
|
|
11
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([df4630a](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/df4630a8d8def6ef36d402f230f6ada86875e71e))
|
|
12
|
-
* **[1441](https://gitlab.widas.de/cidaas-v2/framework/issues/-/issues/1441):** Add the new method for Get Invite User details ([3a2ce7e](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/3a2ce7ec82b3ae91ffc8066081f905972f278985))
|
|
6
|
+
* Add missing params to configure web-authentication ([85e3d08](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/85e3d08792e5ddb01d028e1d008ae5d613b4caeb))
|
|
13
7
|
|
|
14
8
|
# Changelog
|
|
15
9
|
|
|
10
|
+
## V4.2.1
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add authentication type
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- loginWithBrowser can be over-ridden with LoginRedirectOptions
|
|
17
|
+
- popupSignIn can be over-ridden with PopupSignInOptions
|
|
18
|
+
- silentSignIn can be over-ridden with SilentSignInOptions
|
|
19
|
+
- registerWithBrowser can be over-ridden with LoginRedirectOptions
|
|
20
|
+
- loginCallback accepts url location option
|
|
21
|
+
- popupSignInCallback accepts url and keepOpen option
|
|
22
|
+
- silentSignInCallback accepts url location option
|
|
23
|
+
- logout can be over-ridden with LogoutRedirectOptions
|
|
24
|
+
- popupSignOut can be over-ridden with PopupSignOutOptions
|
|
25
|
+
- logoutCallback accepts url location option
|
|
26
|
+
- popupSignOutCallback accepts url location option
|
|
27
|
+
- getLoginURL can be over-ridden with LoginRequestOptions
|
|
28
|
+
|
|
29
|
+
## V4.2.0
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- add back functionality to get missing field from social provider in getMissingFields() function.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- loginWithBrowser now returning promise
|
|
36
|
+
- registerWithBrowser now returning promise
|
|
37
|
+
- popupSignIn now returning User object after popupSignInCallback is finished
|
|
38
|
+
- popupSignInCallback now returning promise
|
|
39
|
+
- popupSignOut now returning promise
|
|
40
|
+
- popupSignOutCallback now returning promise
|
|
41
|
+
|
|
16
42
|
## V4.1.0
|
|
17
43
|
|
|
18
44
|
### Added
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SigninPopupArgs, SigninRedirectArgs, SigninSilentArgs, SignoutPopupArgs, SignoutRedirectArgs, UserManagerSettings, UserManager, OidcClient, CreateSigninRequestArgs, User as OidcUser, SignoutResponse } from 'oidc-client-ts';
|
|
2
|
+
/**
|
|
3
|
+
* @augments UserManagerSettings
|
|
4
|
+
* **/
|
|
5
|
+
export interface OidcSettings extends UserManagerSettings {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @augments UserManager
|
|
9
|
+
* */
|
|
10
|
+
export declare class OidcManager extends UserManager {
|
|
11
|
+
getClient(): OidcClient;
|
|
12
|
+
}
|
|
13
|
+
/***
|
|
14
|
+
* Login request to generate authz url.
|
|
15
|
+
* It's based of the parameters in OIDC specs
|
|
16
|
+
* @augments CreateSigninRequestArgs
|
|
17
|
+
*/
|
|
18
|
+
export interface LoginRequestOptions extends CreateSigninRequestArgs {
|
|
19
|
+
}
|
|
20
|
+
/***
|
|
21
|
+
* Options to override options during redirect login
|
|
22
|
+
* @augments SigninRedirectArgs
|
|
23
|
+
*/
|
|
24
|
+
export interface LoginRedirectOptions extends SigninRedirectArgs {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Response state holding sign out errors if any
|
|
28
|
+
* @augments SignoutResponse
|
|
29
|
+
* **/
|
|
30
|
+
export interface LogoutResponse extends SignoutResponse {
|
|
31
|
+
}
|
|
32
|
+
/***
|
|
33
|
+
* Options to override options during redirect logout
|
|
34
|
+
* @augments SignoutRedirectArgs
|
|
35
|
+
*/
|
|
36
|
+
export interface LogoutRedirectOptions extends SignoutRedirectArgs {
|
|
37
|
+
}
|
|
38
|
+
/***
|
|
39
|
+
* Options to override options during popup sign in
|
|
40
|
+
* @augments SigninPopupArgs
|
|
41
|
+
*/
|
|
42
|
+
export interface PopupSignInOptions extends SigninPopupArgs {
|
|
43
|
+
}
|
|
44
|
+
/***
|
|
45
|
+
* Options to override options during popup sign out
|
|
46
|
+
* @augments SignoutPopupArgs
|
|
47
|
+
*/
|
|
48
|
+
export interface PopupSignOutOptions extends SignoutPopupArgs {
|
|
49
|
+
}
|
|
50
|
+
/***
|
|
51
|
+
* Options to override options during silent sign in
|
|
52
|
+
* @augments SigninSilentArgs
|
|
53
|
+
*/
|
|
54
|
+
export interface SilentSignInOptions extends SigninSilentArgs {
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Authenticated user information including token, id_token and claims
|
|
58
|
+
* @augments OidcUser
|
|
59
|
+
* **/
|
|
60
|
+
export declare class User extends OidcUser {
|
|
61
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
exports.__esModule = true;
|
|
18
|
+
exports.User = exports.OidcManager = void 0;
|
|
19
|
+
var oidc_client_ts_1 = require("oidc-client-ts");
|
|
20
|
+
/**
|
|
21
|
+
* @augments UserManager
|
|
22
|
+
* */
|
|
23
|
+
var OidcManager = /** @class */ (function (_super) {
|
|
24
|
+
__extends(OidcManager, _super);
|
|
25
|
+
function OidcManager() {
|
|
26
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
}
|
|
28
|
+
OidcManager.prototype.getClient = function () {
|
|
29
|
+
return this._client;
|
|
30
|
+
};
|
|
31
|
+
return OidcManager;
|
|
32
|
+
}(oidc_client_ts_1.UserManager));
|
|
33
|
+
exports.OidcManager = OidcManager;
|
|
34
|
+
/**
|
|
35
|
+
* Authenticated user information including token, id_token and claims
|
|
36
|
+
* @augments OidcUser
|
|
37
|
+
* **/
|
|
38
|
+
var User = /** @class */ (function (_super) {
|
|
39
|
+
__extends(User, _super);
|
|
40
|
+
function User() {
|
|
41
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
42
|
+
}
|
|
43
|
+
return User;
|
|
44
|
+
}(oidc_client_ts_1.User));
|
|
45
|
+
exports.User = User;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OidcManager, OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, SilentSignInOptions, LogoutResponse } from './authentication.model';
|
|
2
|
+
export * from './authentication.model';
|
|
2
3
|
export declare class Authentication {
|
|
3
|
-
webAuthSettings:
|
|
4
|
-
userManager:
|
|
5
|
-
constructor(webAuthSettings:
|
|
4
|
+
webAuthSettings: OidcSettings;
|
|
5
|
+
userManager: OidcManager;
|
|
6
|
+
constructor(webAuthSettings: OidcSettings, userManager: OidcManager);
|
|
6
7
|
/**
|
|
7
8
|
* To login through cidaas sdk, call **loginWithBrowser()**. This will redirect you to the hosted login page.
|
|
8
9
|
* once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
@@ -18,8 +19,9 @@ export declare class Authentication {
|
|
|
18
19
|
* ```
|
|
19
20
|
*
|
|
20
21
|
* @param view_type: either 'login' or 'register'
|
|
22
|
+
* @param {LoginRedirectOptions} options optional login options to override the webauth configuration
|
|
21
23
|
*/
|
|
22
|
-
loginOrRegisterWithBrowser(view_type: string): void
|
|
24
|
+
loginOrRegisterWithBrowser(view_type: string, options?: LoginRedirectOptions): Promise<void>;
|
|
23
25
|
/**
|
|
24
26
|
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
25
27
|
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
@@ -31,20 +33,18 @@ export declare class Authentication {
|
|
|
31
33
|
* // your failure code here
|
|
32
34
|
* });
|
|
33
35
|
* ```
|
|
36
|
+
* @param {string} url optional url to read sign in state from
|
|
34
37
|
*/
|
|
35
|
-
loginCallback(): Promise<
|
|
38
|
+
loginCallback(url?: string): Promise<import("oidc-client-ts").User>;
|
|
36
39
|
/**
|
|
37
40
|
* To use the **logout()** method, you need set the redirect url, if not it will automatically redirect to the login page
|
|
38
41
|
* @example
|
|
39
42
|
* ```js
|
|
40
|
-
* cidaas.logout()
|
|
41
|
-
* // your logout success code here
|
|
42
|
-
* }).catch(function(ex) {
|
|
43
|
-
* // your failure code here
|
|
44
|
-
* });
|
|
43
|
+
* cidaas.logout();
|
|
45
44
|
* ```
|
|
45
|
+
* @param {LogoutRedirectOptions} options optional logout options to override webauth configurations
|
|
46
46
|
*/
|
|
47
|
-
logout(): Promise<
|
|
47
|
+
logout(options?: LogoutRedirectOptions): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* **logoutCallback()** will parses the details of userState after logout.
|
|
50
50
|
* @example
|
|
@@ -55,46 +55,63 @@ export declare class Authentication {
|
|
|
55
55
|
* // your failure code here
|
|
56
56
|
* });
|
|
57
57
|
* ```
|
|
58
|
+
* @param {string} url optional url to read signout state from,
|
|
58
59
|
*/
|
|
59
|
-
logoutCallback(): Promise<
|
|
60
|
+
logoutCallback(url?: string): Promise<LogoutResponse>;
|
|
60
61
|
/**
|
|
61
62
|
* **popupSignIn()** will open the hosted login page in pop up window.
|
|
62
63
|
* @example
|
|
63
64
|
* ```js
|
|
64
|
-
* cidaas.popupSignIn()
|
|
65
|
+
* cidaas.popupSignIn().then(function (response) {
|
|
66
|
+
* // the response will give you user details after finishing popupSignInCallback().
|
|
67
|
+
* }).catch(function(ex) {
|
|
68
|
+
* // your failure code here
|
|
69
|
+
* });
|
|
65
70
|
* ```
|
|
71
|
+
* @param {LogoutRedirectOptions} options optional popup sign-in options to override webauth configurations
|
|
66
72
|
*/
|
|
67
|
-
popupSignIn():
|
|
73
|
+
popupSignIn(options?: PopupSignInOptions): Promise<import("oidc-client-ts").User>;
|
|
68
74
|
/**
|
|
69
75
|
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
70
76
|
* Popup window will be closed after doing callback
|
|
71
77
|
* @example
|
|
72
78
|
* ```js
|
|
73
|
-
* cidaas.popupSignInCallback()
|
|
74
|
-
* // the response will give you login details.
|
|
75
|
-
* }).catch(function(ex) {
|
|
76
|
-
* // your failure code here
|
|
77
|
-
* });
|
|
79
|
+
* cidaas.popupSignInCallback();
|
|
78
80
|
* ```
|
|
81
|
+
* @param {string} url optional url to read sign-in callback state from
|
|
82
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign in, else false
|
|
79
83
|
*/
|
|
80
|
-
popupSignInCallback(): void
|
|
84
|
+
popupSignInCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
81
85
|
/**
|
|
82
86
|
* **popupSignOut()** will open the hosted logout page in pop up window.
|
|
83
87
|
* @example
|
|
84
88
|
* ```js
|
|
85
|
-
* cidaas.popupSignOut()
|
|
89
|
+
* cidaas.popupSignOut().then(function() {
|
|
90
|
+
* // success callback in main application window after finishing popupSignOutCallback().
|
|
91
|
+
* }).catch(function(ex) {
|
|
92
|
+
* // your failure code here
|
|
93
|
+
* });
|
|
86
94
|
* ```
|
|
95
|
+
*
|
|
96
|
+
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
87
97
|
*/
|
|
88
|
-
popupSignOut(): void
|
|
98
|
+
popupSignOut(options?: PopupSignOutOptions): Promise<void>;
|
|
89
99
|
/**
|
|
90
100
|
* calling **popupSignOutCallback()** from the popup window complete popup logout process.
|
|
91
101
|
* Popup window won't be closed after doing callback
|
|
92
102
|
* @example
|
|
93
103
|
* ```js
|
|
94
|
-
* cidaas.popupSignOutCallback()
|
|
104
|
+
* cidaas.popupSignOutCallback().then(function() {
|
|
105
|
+
* // success callback in popup window after finishing popupSignOutCallback().
|
|
106
|
+
* }).catch(function(ex) {
|
|
107
|
+
* // your failure code here
|
|
108
|
+
* });
|
|
95
109
|
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param {string} url optional url to override to check for sign out state
|
|
112
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign out, else false
|
|
96
113
|
*/
|
|
97
|
-
popupSignOutCallback(): void
|
|
114
|
+
popupSignOutCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
98
115
|
/**
|
|
99
116
|
* **silentSignIn()** will open the hosted login page in an iframe.
|
|
100
117
|
* this function could only be called from the same domain. Cross Domain is not supported for security purpose.
|
|
@@ -106,14 +123,17 @@ export declare class Authentication {
|
|
|
106
123
|
* // your failure code here
|
|
107
124
|
* });
|
|
108
125
|
* ```
|
|
126
|
+
* @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
|
|
109
127
|
*/
|
|
110
|
-
silentSignIn(): Promise<
|
|
128
|
+
silentSignIn(options?: SilentSignInOptions): Promise<import("oidc-client-ts").User>;
|
|
111
129
|
/**
|
|
112
130
|
* To complete the silent login process, call **silentSignInCallback()** from the iframe. This will complete the login process in iframe.
|
|
113
131
|
* @example
|
|
114
132
|
* ```js
|
|
115
133
|
* cidaas.silentSignInCallback();
|
|
134
|
+
*
|
|
116
135
|
* ```
|
|
136
|
+
* @param {string} url optional url to read sign in state from
|
|
117
137
|
*/
|
|
118
|
-
silentSignInCallback(
|
|
138
|
+
silentSignInCallback(url?: string): Promise<void>;
|
|
119
139
|
}
|