cidaas-javascript-sdk 4.2.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 +22 -3
- package/dist/authentication/authentication.model.d.ts +61 -0
- package/dist/authentication/authentication.model.js +45 -0
- package/dist/authentication/index.d.ts +30 -14
- package/dist/authentication/index.js +62 -26
- package/dist/web-auth/TokenService.js +1 -1
- package/dist/web-auth/WebAuth.d.ts +55 -32
- package/dist/web-auth/WebAuth.js +68 -43
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
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
|
-
*
|
|
6
|
+
* Add missing params to configure web-authentication ([85e3d08](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/85e3d08792e5ddb01d028e1d008ae5d613b4caeb))
|
|
7
7
|
|
|
8
8
|
# Changelog
|
|
9
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
|
+
|
|
10
29
|
## V4.2.0
|
|
11
30
|
|
|
12
31
|
### 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): Promise<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,16 +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<import("oidc-client-ts").User>;
|
|
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
43
|
* cidaas.logout();
|
|
41
44
|
* ```
|
|
45
|
+
* @param {LogoutRedirectOptions} options optional logout options to override webauth configurations
|
|
42
46
|
*/
|
|
43
|
-
logout(): Promise<void>;
|
|
47
|
+
logout(options?: LogoutRedirectOptions): Promise<void>;
|
|
44
48
|
/**
|
|
45
49
|
* **logoutCallback()** will parses the details of userState after logout.
|
|
46
50
|
* @example
|
|
@@ -51,8 +55,9 @@ export declare class Authentication {
|
|
|
51
55
|
* // your failure code here
|
|
52
56
|
* });
|
|
53
57
|
* ```
|
|
58
|
+
* @param {string} url optional url to read signout state from,
|
|
54
59
|
*/
|
|
55
|
-
logoutCallback(): Promise<
|
|
60
|
+
logoutCallback(url?: string): Promise<LogoutResponse>;
|
|
56
61
|
/**
|
|
57
62
|
* **popupSignIn()** will open the hosted login page in pop up window.
|
|
58
63
|
* @example
|
|
@@ -63,8 +68,9 @@ export declare class Authentication {
|
|
|
63
68
|
* // your failure code here
|
|
64
69
|
* });
|
|
65
70
|
* ```
|
|
71
|
+
* @param {LogoutRedirectOptions} options optional popup sign-in options to override webauth configurations
|
|
66
72
|
*/
|
|
67
|
-
popupSignIn(): Promise<import("oidc-client-ts").User>;
|
|
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
|
|
@@ -72,8 +78,10 @@ export declare class Authentication {
|
|
|
72
78
|
* ```js
|
|
73
79
|
* cidaas.popupSignInCallback();
|
|
74
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
|
|
75
83
|
*/
|
|
76
|
-
popupSignInCallback(): Promise<void>;
|
|
84
|
+
popupSignInCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
77
85
|
/**
|
|
78
86
|
* **popupSignOut()** will open the hosted logout page in pop up window.
|
|
79
87
|
* @example
|
|
@@ -84,8 +92,10 @@ export declare class Authentication {
|
|
|
84
92
|
* // your failure code here
|
|
85
93
|
* });
|
|
86
94
|
* ```
|
|
95
|
+
*
|
|
96
|
+
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
87
97
|
*/
|
|
88
|
-
popupSignOut(): Promise<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
|
|
@@ -97,8 +107,11 @@ export declare class Authentication {
|
|
|
97
107
|
* // your failure code here
|
|
98
108
|
* });
|
|
99
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
|
|
100
113
|
*/
|
|
101
|
-
popupSignOutCallback(): Promise<void>;
|
|
114
|
+
popupSignOutCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
102
115
|
/**
|
|
103
116
|
* **silentSignIn()** will open the hosted login page in an iframe.
|
|
104
117
|
* this function could only be called from the same domain. Cross Domain is not supported for security purpose.
|
|
@@ -110,14 +123,17 @@ export declare class Authentication {
|
|
|
110
123
|
* // your failure code here
|
|
111
124
|
* });
|
|
112
125
|
* ```
|
|
126
|
+
* @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
|
|
113
127
|
*/
|
|
114
|
-
silentSignIn(): Promise<import("oidc-client-ts").User>;
|
|
128
|
+
silentSignIn(options?: SilentSignInOptions): Promise<import("oidc-client-ts").User>;
|
|
115
129
|
/**
|
|
116
130
|
* To complete the silent login process, call **silentSignInCallback()** from the iframe. This will complete the login process in iframe.
|
|
117
131
|
* @example
|
|
118
132
|
* ```js
|
|
119
133
|
* cidaas.silentSignInCallback();
|
|
134
|
+
*
|
|
120
135
|
* ```
|
|
136
|
+
* @param {string} url optional url to read sign in state from
|
|
121
137
|
*/
|
|
122
|
-
silentSignInCallback(
|
|
138
|
+
silentSignInCallback(url?: string): Promise<void>;
|
|
123
139
|
}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
2
27
|
exports.__esModule = true;
|
|
3
28
|
exports.Authentication = void 0;
|
|
29
|
+
__exportStar(require("./authentication.model"), exports);
|
|
4
30
|
var Authentication = /** @class */ (function () {
|
|
5
31
|
function Authentication(webAuthSettings, userManager) {
|
|
6
32
|
this.webAuthSettings = webAuthSettings;
|
|
@@ -21,8 +47,9 @@ var Authentication = /** @class */ (function () {
|
|
|
21
47
|
* ```
|
|
22
48
|
*
|
|
23
49
|
* @param view_type: either 'login' or 'register'
|
|
50
|
+
* @param {LoginRedirectOptions} options optional login options to override the webauth configuration
|
|
24
51
|
*/
|
|
25
|
-
Authentication.prototype.loginOrRegisterWithBrowser = function (view_type) {
|
|
52
|
+
Authentication.prototype.loginOrRegisterWithBrowser = function (view_type, options) {
|
|
26
53
|
var _a;
|
|
27
54
|
if (!this.webAuthSettings.extraQueryParams) {
|
|
28
55
|
this.webAuthSettings.extraQueryParams = {};
|
|
@@ -31,10 +58,7 @@ var Authentication = /** @class */ (function () {
|
|
|
31
58
|
if (this.webAuthSettings.response_type.indexOf("id_token") == -1 && ((_a = this.webAuthSettings.scope) === null || _a === void 0 ? void 0 : _a.indexOf("openid")) != -1 && !this.webAuthSettings.extraQueryParams.nonce) {
|
|
32
59
|
this.webAuthSettings.extraQueryParams.nonce = new Date().getTime().toString();
|
|
33
60
|
}
|
|
34
|
-
return this.userManager.signinRedirect({
|
|
35
|
-
extraQueryParams: this.webAuthSettings.extraQueryParams,
|
|
36
|
-
redirect_uri: this.webAuthSettings.redirect_uri
|
|
37
|
-
});
|
|
61
|
+
return this.userManager.signinRedirect(__assign({ extraQueryParams: this.webAuthSettings.extraQueryParams, redirect_uri: this.webAuthSettings.redirect_uri }, (options && { options: options } || {})));
|
|
38
62
|
};
|
|
39
63
|
;
|
|
40
64
|
/**
|
|
@@ -48,9 +72,10 @@ var Authentication = /** @class */ (function () {
|
|
|
48
72
|
* // your failure code here
|
|
49
73
|
* });
|
|
50
74
|
* ```
|
|
75
|
+
* @param {string} url optional url to read sign in state from
|
|
51
76
|
*/
|
|
52
|
-
Authentication.prototype.loginCallback = function () {
|
|
53
|
-
return this.userManager.signinRedirectCallback();
|
|
77
|
+
Authentication.prototype.loginCallback = function (url) {
|
|
78
|
+
return this.userManager.signinRedirectCallback(url);
|
|
54
79
|
};
|
|
55
80
|
/**
|
|
56
81
|
* To use the **logout()** method, you need set the redirect url, if not it will automatically redirect to the login page
|
|
@@ -58,9 +83,10 @@ var Authentication = /** @class */ (function () {
|
|
|
58
83
|
* ```js
|
|
59
84
|
* cidaas.logout();
|
|
60
85
|
* ```
|
|
86
|
+
* @param {LogoutRedirectOptions} options optional logout options to override webauth configurations
|
|
61
87
|
*/
|
|
62
|
-
Authentication.prototype.logout = function () {
|
|
63
|
-
return this.userManager.signoutRedirect(
|
|
88
|
+
Authentication.prototype.logout = function (options) {
|
|
89
|
+
return this.userManager.signoutRedirect(options);
|
|
64
90
|
};
|
|
65
91
|
/**
|
|
66
92
|
* **logoutCallback()** will parses the details of userState after logout.
|
|
@@ -72,9 +98,10 @@ var Authentication = /** @class */ (function () {
|
|
|
72
98
|
* // your failure code here
|
|
73
99
|
* });
|
|
74
100
|
* ```
|
|
101
|
+
* @param {string} url optional url to read signout state from,
|
|
75
102
|
*/
|
|
76
|
-
Authentication.prototype.logoutCallback = function () {
|
|
77
|
-
return this.userManager.signoutRedirectCallback();
|
|
103
|
+
Authentication.prototype.logoutCallback = function (url) {
|
|
104
|
+
return this.userManager.signoutRedirectCallback(url);
|
|
78
105
|
};
|
|
79
106
|
;
|
|
80
107
|
/**
|
|
@@ -87,9 +114,10 @@ var Authentication = /** @class */ (function () {
|
|
|
87
114
|
* // your failure code here
|
|
88
115
|
* });
|
|
89
116
|
* ```
|
|
117
|
+
* @param {LogoutRedirectOptions} options optional popup sign-in options to override webauth configurations
|
|
90
118
|
*/
|
|
91
|
-
Authentication.prototype.popupSignIn = function () {
|
|
92
|
-
return this.userManager.signinPopup();
|
|
119
|
+
Authentication.prototype.popupSignIn = function (options) {
|
|
120
|
+
return this.userManager.signinPopup(options);
|
|
93
121
|
};
|
|
94
122
|
;
|
|
95
123
|
/**
|
|
@@ -99,9 +127,11 @@ var Authentication = /** @class */ (function () {
|
|
|
99
127
|
* ```js
|
|
100
128
|
* cidaas.popupSignInCallback();
|
|
101
129
|
* ```
|
|
130
|
+
* @param {string} url optional url to read sign-in callback state from
|
|
131
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign in, else false
|
|
102
132
|
*/
|
|
103
|
-
Authentication.prototype.popupSignInCallback = function () {
|
|
104
|
-
return this.userManager.signinPopupCallback();
|
|
133
|
+
Authentication.prototype.popupSignInCallback = function (url, keepOpen) {
|
|
134
|
+
return this.userManager.signinPopupCallback(url, keepOpen);
|
|
105
135
|
};
|
|
106
136
|
;
|
|
107
137
|
/**
|
|
@@ -114,9 +144,11 @@ var Authentication = /** @class */ (function () {
|
|
|
114
144
|
* // your failure code here
|
|
115
145
|
* });
|
|
116
146
|
* ```
|
|
147
|
+
*
|
|
148
|
+
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
117
149
|
*/
|
|
118
|
-
Authentication.prototype.popupSignOut = function () {
|
|
119
|
-
return this.userManager.signoutPopup(
|
|
150
|
+
Authentication.prototype.popupSignOut = function (options) {
|
|
151
|
+
return this.userManager.signoutPopup(options);
|
|
120
152
|
};
|
|
121
153
|
;
|
|
122
154
|
/**
|
|
@@ -130,9 +162,13 @@ var Authentication = /** @class */ (function () {
|
|
|
130
162
|
* // your failure code here
|
|
131
163
|
* });
|
|
132
164
|
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param {string} url optional url to override to check for sign out state
|
|
167
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign out, else false
|
|
133
168
|
*/
|
|
134
|
-
Authentication.prototype.popupSignOutCallback = function () {
|
|
135
|
-
|
|
169
|
+
Authentication.prototype.popupSignOutCallback = function (url, keepOpen) {
|
|
170
|
+
if (keepOpen === void 0) { keepOpen = true; }
|
|
171
|
+
return this.userManager.signoutPopupCallback(url, keepOpen);
|
|
136
172
|
};
|
|
137
173
|
;
|
|
138
174
|
/**
|
|
@@ -146,12 +182,10 @@ var Authentication = /** @class */ (function () {
|
|
|
146
182
|
* // your failure code here
|
|
147
183
|
* });
|
|
148
184
|
* ```
|
|
185
|
+
* @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
|
|
149
186
|
*/
|
|
150
|
-
Authentication.prototype.silentSignIn = function () {
|
|
151
|
-
return this.userManager.signinSilent({
|
|
152
|
-
state: this.webAuthSettings,
|
|
153
|
-
silentRequestTimeoutInSeconds: 60
|
|
154
|
-
});
|
|
187
|
+
Authentication.prototype.silentSignIn = function (options) {
|
|
188
|
+
return this.userManager.signinSilent(__assign({ silentRequestTimeoutInSeconds: 60 }, (options && { options: options } || {})));
|
|
155
189
|
};
|
|
156
190
|
;
|
|
157
191
|
/**
|
|
@@ -159,10 +193,12 @@ var Authentication = /** @class */ (function () {
|
|
|
159
193
|
* @example
|
|
160
194
|
* ```js
|
|
161
195
|
* cidaas.silentSignInCallback();
|
|
196
|
+
*
|
|
162
197
|
* ```
|
|
198
|
+
* @param {string} url optional url to read sign in state from
|
|
163
199
|
*/
|
|
164
|
-
Authentication.prototype.silentSignInCallback = function (
|
|
165
|
-
return this.userManager.signinSilentCallback(
|
|
200
|
+
Authentication.prototype.silentSignInCallback = function (url) {
|
|
201
|
+
return this.userManager.signinSilentCallback(url);
|
|
166
202
|
};
|
|
167
203
|
;
|
|
168
204
|
return Authentication;
|
|
@@ -102,7 +102,7 @@ var TokenService;
|
|
|
102
102
|
options.redirect_uri = window.webAuthSettings.redirect_uri;
|
|
103
103
|
options.grant_type = "authorization_code";
|
|
104
104
|
if (!!window.webAuthSettings.disablePKCE) return [3 /*break*/, 2];
|
|
105
|
-
return [4 /*yield*/, window.usermanager.
|
|
105
|
+
return [4 /*yield*/, window.usermanager.getClient().createSigninRequest(window.webAuthSettings)];
|
|
106
106
|
case 1:
|
|
107
107
|
signInRequest = _b.sent();
|
|
108
108
|
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, SilentSignInOptions, LoginRequestOptions, User, LogoutResponse } from '../authentication';
|
|
2
2
|
import { AccessTokenRequest, TokenIntrospectionEntity, UserEntity, ResetPasswordEntity, IConfiguredListRequestEntity, IInitVerificationAuthenticationRequestEntity, FindUserEntity, IUserEntity, IEnrollVerificationSetupRequestEntity, IUserLinkEntity, ChangePasswordEntity, IConsentAcceptEntity, IAuthVerificationAuthenticationRequestEntity, LoginFormRequestEntity, AccountVerificationRequestEntity, ValidateResetPasswordEntity, AcceptResetPasswordEntity, PhysicalVerificationLoginRequest, IChangePasswordEntity, IUserActivityPayloadEntity } from "./Entities";
|
|
3
3
|
export declare const createPreloginWebauth: (authority: string) => WebAuth;
|
|
4
4
|
export declare class WebAuth {
|
|
5
|
-
constructor(settings:
|
|
5
|
+
constructor(settings: OidcSettings);
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Generate and redirect to authz url in same window for logging in.
|
|
8
|
+
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
8
9
|
*/
|
|
9
|
-
loginWithBrowser():
|
|
10
|
+
loginWithBrowser(options?: LoginRedirectOptions): Promise<void>;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Generate and open authz url in a popup window.
|
|
13
|
+
* On successful sign in, authenticated user is returned.
|
|
14
|
+
*
|
|
15
|
+
* @param {PopupSignInOptions} options options to over-ride the client config for popup sign in
|
|
16
|
+
* @returns {Promise<User>} Authenticated user
|
|
17
|
+
* @throws error if unable to get the parse and get user
|
|
12
18
|
*/
|
|
13
|
-
popupSignIn():
|
|
19
|
+
popupSignIn(options?: PopupSignInOptions): Promise<User>;
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Generate and navigate to authz url in an iFrame.
|
|
22
|
+
* On successful sign in, authenticated user is returned
|
|
23
|
+
*
|
|
24
|
+
* @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
|
|
25
|
+
* @returns {Promise<User>} Authenticated user
|
|
26
|
+
* @throws error if unable to get the parse and get user
|
|
16
27
|
*/
|
|
17
|
-
silentSignIn():
|
|
28
|
+
silentSignIn(options?: SilentSignInOptions): Promise<User>;
|
|
18
29
|
/**
|
|
19
|
-
* register
|
|
30
|
+
* Generate and redirect to authz url in same window for register view.
|
|
31
|
+
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
20
32
|
*/
|
|
21
|
-
registerWithBrowser():
|
|
33
|
+
registerWithBrowser(options?: LoginRedirectOptions): Promise<void>;
|
|
22
34
|
/**
|
|
23
|
-
* login
|
|
24
|
-
*
|
|
35
|
+
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
36
|
+
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} url optional url from where to process the login state
|
|
39
|
+
* @returns {Promise<User>} Authenticated user
|
|
40
|
+
* @throws error if unable to get the parse and get user
|
|
25
41
|
*/
|
|
26
|
-
loginCallback():
|
|
42
|
+
loginCallback(url?: string): Promise<User>;
|
|
27
43
|
/**
|
|
28
|
-
* popup
|
|
29
|
-
*
|
|
44
|
+
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
45
|
+
* Popup window will be closed after doing callback
|
|
46
|
+
*
|
|
47
|
+
* @param {string} url optional url to read sign-in callback state from
|
|
48
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign in, else false
|
|
30
49
|
*/
|
|
31
|
-
popupSignInCallback():
|
|
50
|
+
popupSignInCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
32
51
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
52
|
+
* Returns a promise to notify the parent window of response from authz service
|
|
53
|
+
* @param {string} url optional url to check authz response, if none window.location is used
|
|
35
54
|
*/
|
|
36
|
-
silentSignInCallback():
|
|
55
|
+
silentSignInCallback(url?: string): Promise<void>;
|
|
37
56
|
/**
|
|
38
57
|
* To get the user profile information by using oidc-client-ts library, call **getUserInfo()**. This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
|
|
39
58
|
* @example
|
|
@@ -44,28 +63,30 @@ export declare class WebAuth {
|
|
|
44
63
|
* // your failure code here
|
|
45
64
|
* });
|
|
46
65
|
* ```
|
|
66
|
+
* @return {Promise<User|null>} returns authenticated user if present, else null
|
|
47
67
|
*/
|
|
48
|
-
getUserInfo(): Promise<
|
|
68
|
+
getUserInfo(): Promise<User | null>;
|
|
49
69
|
/**
|
|
50
70
|
* logout by using oidc-client-ts library
|
|
51
|
-
* @
|
|
71
|
+
* @param {LogoutRedirectOptions} options optional options to over-ride logout options on redirect
|
|
52
72
|
*/
|
|
53
|
-
logout():
|
|
73
|
+
logout(options?: LogoutRedirectOptions): Promise<void>;
|
|
54
74
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
75
|
+
* logout by using oidc-client-ts library
|
|
76
|
+
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
57
77
|
*/
|
|
58
|
-
popupSignOut():
|
|
78
|
+
popupSignOut(options?: PopupSignOutOptions): Promise<void>;
|
|
59
79
|
/**
|
|
60
|
-
* logout
|
|
61
|
-
* @returns
|
|
80
|
+
* get the logout call state from the url provided, if none is provided current window url is used
|
|
81
|
+
* @returns {Promise<LogoutResponse>} logout response from auth service
|
|
62
82
|
*/
|
|
63
|
-
logoutCallback():
|
|
83
|
+
logoutCallback(url?: string): Promise<LogoutResponse>;
|
|
64
84
|
/**
|
|
65
|
-
* popup
|
|
66
|
-
* @
|
|
85
|
+
* listen to popup sign out event
|
|
86
|
+
* @param {string} url optional url to override to check for sign out state
|
|
87
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign out, else false
|
|
67
88
|
*/
|
|
68
|
-
popupSignOutCallback():
|
|
89
|
+
popupSignOutCallback(url?: string, keepOpen?: boolean): Promise<void>;
|
|
69
90
|
/**
|
|
70
91
|
* To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
|
|
71
92
|
* @example
|
|
@@ -76,8 +97,10 @@ export declare class WebAuth {
|
|
|
76
97
|
* // your failure code here
|
|
77
98
|
* });
|
|
78
99
|
* ```
|
|
100
|
+
* @param {LoginRequestOptions} options login options to override {@link window.webAuthSettings} provided
|
|
101
|
+
* @return {Promise<string>} authz url for login
|
|
79
102
|
*/
|
|
80
|
-
getLoginURL(
|
|
103
|
+
getLoginURL(options?: LoginRequestOptions): Promise<string>;
|
|
81
104
|
/**
|
|
82
105
|
* Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call **getRequestId()**.
|
|
83
106
|
* @example
|
package/dist/web-auth/WebAuth.js
CHANGED
|
@@ -48,7 +48,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
};
|
|
49
49
|
exports.__esModule = true;
|
|
50
50
|
exports.WebAuth = exports.createPreloginWebauth = void 0;
|
|
51
|
-
var oidc_client_ts_1 = require("oidc-client-ts");
|
|
52
51
|
var authentication_1 = require("../authentication");
|
|
53
52
|
var Helper_1 = require("./Helper");
|
|
54
53
|
var LoginService_1 = require("./LoginService");
|
|
@@ -72,7 +71,7 @@ var WebAuth = /** @class */ (function () {
|
|
|
72
71
|
if (settings.authority && settings.authority.charAt(settings.authority.length - 1) === '/') {
|
|
73
72
|
settings.authority = settings.authority.slice(0, settings.authority.length - 1);
|
|
74
73
|
}
|
|
75
|
-
var usermanager = new
|
|
74
|
+
var usermanager = new authentication_1.OidcManager(settings);
|
|
76
75
|
window.webAuthSettings = settings;
|
|
77
76
|
window.usermanager = usermanager;
|
|
78
77
|
window.localeSettings = null;
|
|
@@ -87,76 +86,95 @@ var WebAuth = /** @class */ (function () {
|
|
|
87
86
|
}
|
|
88
87
|
// prototype methods
|
|
89
88
|
/**
|
|
90
|
-
*
|
|
89
|
+
* Generate and redirect to authz url in same window for logging in.
|
|
90
|
+
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
91
91
|
*/
|
|
92
|
-
WebAuth.prototype.loginWithBrowser = function () {
|
|
92
|
+
WebAuth.prototype.loginWithBrowser = function (options) {
|
|
93
93
|
if (!window.webAuthSettings || !window.authentication) {
|
|
94
94
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
95
95
|
}
|
|
96
|
-
return window.authentication.loginOrRegisterWithBrowser('login');
|
|
96
|
+
return window.authentication.loginOrRegisterWithBrowser('login', options);
|
|
97
97
|
};
|
|
98
98
|
;
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* Generate and open authz url in a popup window.
|
|
101
|
+
* On successful sign in, authenticated user is returned.
|
|
102
|
+
*
|
|
103
|
+
* @param {PopupSignInOptions} options options to over-ride the client config for popup sign in
|
|
104
|
+
* @returns {Promise<User>} Authenticated user
|
|
105
|
+
* @throws error if unable to get the parse and get user
|
|
101
106
|
*/
|
|
102
|
-
WebAuth.prototype.popupSignIn = function () {
|
|
107
|
+
WebAuth.prototype.popupSignIn = function (options) {
|
|
103
108
|
if (!window.webAuthSettings || !window.authentication) {
|
|
104
109
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
105
110
|
}
|
|
106
|
-
return window.authentication.popupSignIn();
|
|
111
|
+
return window.authentication.popupSignIn(options);
|
|
107
112
|
};
|
|
108
113
|
;
|
|
109
114
|
/**
|
|
110
|
-
*
|
|
115
|
+
* Generate and navigate to authz url in an iFrame.
|
|
116
|
+
* On successful sign in, authenticated user is returned
|
|
117
|
+
*
|
|
118
|
+
* @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
|
|
119
|
+
* @returns {Promise<User>} Authenticated user
|
|
120
|
+
* @throws error if unable to get the parse and get user
|
|
111
121
|
*/
|
|
112
|
-
WebAuth.prototype.silentSignIn = function () {
|
|
122
|
+
WebAuth.prototype.silentSignIn = function (options) {
|
|
113
123
|
if (!window.webAuthSettings || !window.authentication) {
|
|
114
124
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
115
125
|
}
|
|
116
|
-
return window.authentication.silentSignIn();
|
|
126
|
+
return window.authentication.silentSignIn(options);
|
|
117
127
|
};
|
|
118
128
|
;
|
|
119
129
|
/**
|
|
120
|
-
* register
|
|
130
|
+
* Generate and redirect to authz url in same window for register view.
|
|
131
|
+
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
121
132
|
*/
|
|
122
|
-
WebAuth.prototype.registerWithBrowser = function () {
|
|
133
|
+
WebAuth.prototype.registerWithBrowser = function (options) {
|
|
123
134
|
if (!window.webAuthSettings || !window.authentication) {
|
|
124
135
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
125
136
|
}
|
|
126
|
-
return window.authentication.loginOrRegisterWithBrowser('register');
|
|
137
|
+
return window.authentication.loginOrRegisterWithBrowser('register', options);
|
|
127
138
|
};
|
|
128
139
|
;
|
|
129
140
|
/**
|
|
130
|
-
* login
|
|
131
|
-
*
|
|
141
|
+
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
142
|
+
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
143
|
+
*
|
|
144
|
+
* @param {string} url optional url from where to process the login state
|
|
145
|
+
* @returns {Promise<User>} Authenticated user
|
|
146
|
+
* @throws error if unable to get the parse and get user
|
|
132
147
|
*/
|
|
133
|
-
WebAuth.prototype.loginCallback = function () {
|
|
148
|
+
WebAuth.prototype.loginCallback = function (url) {
|
|
134
149
|
if (!window.webAuthSettings || !window.authentication) {
|
|
135
150
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
136
151
|
}
|
|
137
|
-
return window.authentication.loginCallback();
|
|
152
|
+
return window.authentication.loginCallback(url);
|
|
138
153
|
};
|
|
139
154
|
;
|
|
140
155
|
/**
|
|
141
|
-
* popup
|
|
142
|
-
*
|
|
156
|
+
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
157
|
+
* Popup window will be closed after doing callback
|
|
158
|
+
*
|
|
159
|
+
* @param {string} url optional url to read sign-in callback state from
|
|
160
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign in, else false
|
|
143
161
|
*/
|
|
144
|
-
WebAuth.prototype.popupSignInCallback = function () {
|
|
162
|
+
WebAuth.prototype.popupSignInCallback = function (url, keepOpen) {
|
|
145
163
|
if (!window.webAuthSettings || !window.authentication) {
|
|
146
164
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
147
165
|
}
|
|
148
|
-
return window.authentication.popupSignInCallback();
|
|
166
|
+
return window.authentication.popupSignInCallback(url, keepOpen);
|
|
149
167
|
};
|
|
150
168
|
;
|
|
151
169
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @
|
|
170
|
+
* Returns a promise to notify the parent window of response from authz service
|
|
171
|
+
* @param {string} url optional url to check authz response, if none window.location is used
|
|
154
172
|
*/
|
|
155
|
-
WebAuth.prototype.silentSignInCallback = function () {
|
|
173
|
+
WebAuth.prototype.silentSignInCallback = function (url) {
|
|
156
174
|
if (!window.webAuthSettings || !window.authentication) {
|
|
157
175
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
158
176
|
}
|
|
159
|
-
return window.authentication.silentSignInCallback();
|
|
177
|
+
return window.authentication.silentSignInCallback(url);
|
|
160
178
|
};
|
|
161
179
|
;
|
|
162
180
|
/**
|
|
@@ -169,6 +187,7 @@ var WebAuth = /** @class */ (function () {
|
|
|
169
187
|
* // your failure code here
|
|
170
188
|
* });
|
|
171
189
|
* ```
|
|
190
|
+
* @return {Promise<User|null>} returns authenticated user if present, else null
|
|
172
191
|
*/
|
|
173
192
|
WebAuth.prototype.getUserInfo = function () {
|
|
174
193
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -187,46 +206,47 @@ var WebAuth = /** @class */ (function () {
|
|
|
187
206
|
;
|
|
188
207
|
/**
|
|
189
208
|
* logout by using oidc-client-ts library
|
|
190
|
-
* @
|
|
209
|
+
* @param {LogoutRedirectOptions} options optional options to over-ride logout options on redirect
|
|
191
210
|
*/
|
|
192
|
-
WebAuth.prototype.logout = function () {
|
|
211
|
+
WebAuth.prototype.logout = function (options) {
|
|
193
212
|
if (!window.webAuthSettings || !window.authentication) {
|
|
194
213
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
195
214
|
}
|
|
196
|
-
return window.authentication.logout();
|
|
215
|
+
return window.authentication.logout(options);
|
|
197
216
|
};
|
|
198
217
|
;
|
|
199
218
|
/**
|
|
200
|
-
*
|
|
201
|
-
* @
|
|
219
|
+
* logout by using oidc-client-ts library
|
|
220
|
+
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
202
221
|
*/
|
|
203
|
-
WebAuth.prototype.popupSignOut = function () {
|
|
222
|
+
WebAuth.prototype.popupSignOut = function (options) {
|
|
204
223
|
if (!window.webAuthSettings || !window.authentication) {
|
|
205
224
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
206
225
|
}
|
|
207
|
-
return window.authentication.popupSignOut();
|
|
226
|
+
return window.authentication.popupSignOut(options);
|
|
208
227
|
};
|
|
209
228
|
;
|
|
210
229
|
/**
|
|
211
|
-
* logout
|
|
212
|
-
* @returns
|
|
230
|
+
* get the logout call state from the url provided, if none is provided current window url is used
|
|
231
|
+
* @returns {Promise<LogoutResponse>} logout response from auth service
|
|
213
232
|
*/
|
|
214
|
-
WebAuth.prototype.logoutCallback = function () {
|
|
233
|
+
WebAuth.prototype.logoutCallback = function (url) {
|
|
215
234
|
if (!window.webAuthSettings || !window.authentication) {
|
|
216
235
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
217
236
|
}
|
|
218
|
-
return window.authentication.logoutCallback();
|
|
237
|
+
return window.authentication.logoutCallback(url);
|
|
219
238
|
};
|
|
220
239
|
;
|
|
221
240
|
/**
|
|
222
|
-
* popup
|
|
223
|
-
* @
|
|
241
|
+
* listen to popup sign out event
|
|
242
|
+
* @param {string} url optional url to override to check for sign out state
|
|
243
|
+
* @param {boolean} keepOpen true to keep the popup open even after sign out, else false
|
|
224
244
|
*/
|
|
225
|
-
WebAuth.prototype.popupSignOutCallback = function () {
|
|
245
|
+
WebAuth.prototype.popupSignOutCallback = function (url, keepOpen) {
|
|
226
246
|
if (!window.webAuthSettings || !window.authentication) {
|
|
227
247
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
228
248
|
}
|
|
229
|
-
return window.authentication.popupSignOutCallback();
|
|
249
|
+
return window.authentication.popupSignOutCallback(url, keepOpen);
|
|
230
250
|
};
|
|
231
251
|
;
|
|
232
252
|
/**
|
|
@@ -239,11 +259,16 @@ var WebAuth = /** @class */ (function () {
|
|
|
239
259
|
* // your failure code here
|
|
240
260
|
* });
|
|
241
261
|
* ```
|
|
262
|
+
* @param {LoginRequestOptions} options login options to override {@link window.webAuthSettings} provided
|
|
263
|
+
* @return {Promise<string>} authz url for login
|
|
242
264
|
*/
|
|
243
|
-
WebAuth.prototype.getLoginURL = function (
|
|
265
|
+
WebAuth.prototype.getLoginURL = function (options) {
|
|
266
|
+
if (!window.webAuthSettings || !window.authentication) {
|
|
267
|
+
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
268
|
+
}
|
|
244
269
|
return new Promise(function (resolve, reject) {
|
|
245
270
|
try {
|
|
246
|
-
window.usermanager.
|
|
271
|
+
window.usermanager.getClient().createSigninRequest(__assign(__assign({}, window.webAuthSettings), (options && { options: options } || {}))).then(function (signinRequest) {
|
|
247
272
|
resolve(signinRequest.url);
|
|
248
273
|
});
|
|
249
274
|
}
|