@elliemae/pui-app-sdk 6.0.0-alpha.2 → 6.0.0-alpha.3
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/dist/cjs/data/auth/actions.js +10 -2
- package/dist/cjs/package.json +4 -1
- package/dist/cjs/utils/auth/index.js +65 -19
- package/dist/cjs/view/login/index.js +29 -2
- package/dist/cjs/view/require-auth.js +22 -2
- package/dist/esm/data/auth/actions.js +10 -2
- package/dist/esm/package.json +4 -1
- package/dist/esm/utils/auth/index.js +65 -19
- package/dist/esm/view/login/index.js +29 -2
- package/dist/esm/view/require-auth.js +22 -2
- package/dist/types/lib/data/auth/actions.d.ts +2 -1
- package/dist/types/lib/utils/auth/index.d.ts +58 -3
- package/dist/types/lib/utils/auth/types.d.ts +1 -0
- package/dist/types/lib/view/login/index.d.ts +28 -1
- package/dist/types/lib/view/login/tests/index.test.d.ts +1 -0
- package/dist/types/lib/view/require-auth.d.ts +29 -1
- package/dist/types/lib/view/tests/require-auth.test.d.ts +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -43,9 +43,17 @@ const auth = {
|
|
|
43
43
|
redirectUri,
|
|
44
44
|
responseType,
|
|
45
45
|
scope,
|
|
46
|
-
code
|
|
46
|
+
code,
|
|
47
|
+
customLogoutUrl
|
|
47
48
|
}) => ({
|
|
48
49
|
type: LOGOUT,
|
|
49
|
-
payload: {
|
|
50
|
+
payload: {
|
|
51
|
+
clientId,
|
|
52
|
+
redirectUri,
|
|
53
|
+
responseType,
|
|
54
|
+
scope,
|
|
55
|
+
code,
|
|
56
|
+
customLogoutUrl
|
|
57
|
+
}
|
|
50
58
|
})
|
|
51
59
|
};
|
package/dist/cjs/package.json
CHANGED
|
@@ -50,19 +50,42 @@ const navigateToLoginPage = ({
|
|
|
50
50
|
redirectUri,
|
|
51
51
|
idpErrorCode,
|
|
52
52
|
scope,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
responseType,
|
|
54
|
+
instanceId,
|
|
55
|
+
siteId,
|
|
56
|
+
userId,
|
|
57
|
+
disableRememberMe,
|
|
58
|
+
useCompactIdpPage,
|
|
59
|
+
isSSO
|
|
55
60
|
}) => {
|
|
56
61
|
const idpHost = (0, import_config.getAppConfigValue)(IDP_ENDPOINT_CONFIG_KEY, "");
|
|
57
62
|
const idpUrl = new URL("/authorize", idpHost);
|
|
58
63
|
const idpOptions = {
|
|
59
64
|
client_id: clientId,
|
|
60
65
|
redirect_uri: redirectUri,
|
|
61
|
-
response_type: responseType,
|
|
62
|
-
scope
|
|
66
|
+
response_type: responseType ?? "",
|
|
67
|
+
scope,
|
|
68
|
+
...instanceId !== void 0 && {
|
|
69
|
+
instance_id: String(instanceId)
|
|
70
|
+
},
|
|
71
|
+
...siteId !== void 0 && {
|
|
72
|
+
site_id: String(siteId)
|
|
73
|
+
},
|
|
74
|
+
...userId !== void 0 && {
|
|
75
|
+
user_id: userId
|
|
76
|
+
},
|
|
77
|
+
...disableRememberMe !== void 0 && {
|
|
78
|
+
disable_remember_me: String(disableRememberMe)
|
|
79
|
+
},
|
|
80
|
+
...useCompactIdpPage !== void 0 && {
|
|
81
|
+
tpoifr: String(useCompactIdpPage)
|
|
82
|
+
},
|
|
83
|
+
...isSSO !== void 0 && {
|
|
84
|
+
is_sso: String(isSSO)
|
|
85
|
+
}
|
|
63
86
|
};
|
|
64
87
|
const searchParams = new URLSearchParams(
|
|
65
|
-
idpErrorCode ?
|
|
88
|
+
idpErrorCode ? { ...idpOptions, error_code: idpErrorCode } : idpOptions
|
|
66
89
|
);
|
|
67
90
|
idpUrl.search = searchParams.toString();
|
|
68
91
|
window.location.replace(idpUrl.href);
|
|
@@ -73,6 +96,7 @@ const endSession = async ({
|
|
|
73
96
|
responseType,
|
|
74
97
|
scope,
|
|
75
98
|
code = "",
|
|
99
|
+
customLogoutUrl = "",
|
|
76
100
|
skipRevoke = false
|
|
77
101
|
}) => {
|
|
78
102
|
try {
|
|
@@ -86,17 +110,22 @@ const endSession = async ({
|
|
|
86
110
|
});
|
|
87
111
|
(0, import_user_session_event.logoutEvent)();
|
|
88
112
|
(0, import_appdynamics.setAppDynamicsUserData)({ instanceId: "", userId: "" });
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
let logoutUrl;
|
|
114
|
+
if (customLogoutUrl) {
|
|
115
|
+
logoutUrl = new URL("/", customLogoutUrl);
|
|
116
|
+
} else {
|
|
117
|
+
const idpHost = (0, import_config.getAppConfigValue)(IDP_ENDPOINT_CONFIG_KEY, "");
|
|
118
|
+
logoutUrl = new URL("/authorize", idpHost);
|
|
119
|
+
const params = {
|
|
120
|
+
client_id: clientId,
|
|
121
|
+
redirect_uri: redirectUri,
|
|
122
|
+
...code && { error_code: code },
|
|
123
|
+
response_type: responseType,
|
|
124
|
+
scope
|
|
125
|
+
};
|
|
126
|
+
const searchParams = new URLSearchParams(params);
|
|
127
|
+
logoutUrl.search = searchParams.toString();
|
|
128
|
+
}
|
|
100
129
|
window.location.replace(logoutUrl.href);
|
|
101
130
|
} catch (err) {
|
|
102
131
|
(0, import_logger.getLogger)()?.error({
|
|
@@ -119,7 +148,12 @@ const authorize = async ({
|
|
|
119
148
|
scope,
|
|
120
149
|
redirectUri
|
|
121
150
|
});
|
|
122
|
-
(0, import_loginParams.setLoginParams)({
|
|
151
|
+
(0, import_loginParams.setLoginParams)({
|
|
152
|
+
clientId,
|
|
153
|
+
scope,
|
|
154
|
+
responseType,
|
|
155
|
+
redirectUri
|
|
156
|
+
});
|
|
123
157
|
const authorizationToken = `${tokenType} ${accessToken}`;
|
|
124
158
|
(0, import_helper.setAuthorizationHeader)(authorizationToken);
|
|
125
159
|
const introspectResponse = await (0, import_auth.introspectToken)({
|
|
@@ -165,7 +199,13 @@ const authorize = async ({
|
|
|
165
199
|
const login = async ({
|
|
166
200
|
clientId,
|
|
167
201
|
scope,
|
|
168
|
-
responseType
|
|
202
|
+
responseType,
|
|
203
|
+
instanceId,
|
|
204
|
+
siteId,
|
|
205
|
+
userId,
|
|
206
|
+
disableRememberMe,
|
|
207
|
+
useCompactIdpPage,
|
|
208
|
+
isSSO
|
|
169
209
|
}) => {
|
|
170
210
|
const { code, idpErrorCode, redirectUri } = getIDPInfoFromUrl();
|
|
171
211
|
const loginInfo = {
|
|
@@ -174,7 +214,13 @@ const login = async ({
|
|
|
174
214
|
responseType,
|
|
175
215
|
redirectUri,
|
|
176
216
|
code,
|
|
177
|
-
idpErrorCode
|
|
217
|
+
idpErrorCode,
|
|
218
|
+
instanceId,
|
|
219
|
+
siteId,
|
|
220
|
+
userId,
|
|
221
|
+
disableRememberMe,
|
|
222
|
+
useCompactIdpPage,
|
|
223
|
+
isSSO
|
|
178
224
|
};
|
|
179
225
|
if (code) {
|
|
180
226
|
await authorize(loginInfo);
|
|
@@ -30,6 +30,12 @@ const Login = ({
|
|
|
30
30
|
clientId,
|
|
31
31
|
scope,
|
|
32
32
|
responseType,
|
|
33
|
+
instanceId,
|
|
34
|
+
siteId,
|
|
35
|
+
userId,
|
|
36
|
+
disableRememberMe,
|
|
37
|
+
useCompactIdpPage,
|
|
38
|
+
isSSO,
|
|
33
39
|
children
|
|
34
40
|
}) => {
|
|
35
41
|
const [userAuthorized, setUserAuthorized] = (0, import_react.useState)(false);
|
|
@@ -38,13 +44,34 @@ const Login = ({
|
|
|
38
44
|
(0, import_react.useEffect)(() => {
|
|
39
45
|
if (ref.current) return;
|
|
40
46
|
ref.current = true;
|
|
41
|
-
(0, import_auth.login)({
|
|
47
|
+
(0, import_auth.login)({
|
|
48
|
+
clientId,
|
|
49
|
+
scope,
|
|
50
|
+
responseType,
|
|
51
|
+
instanceId,
|
|
52
|
+
siteId,
|
|
53
|
+
userId,
|
|
54
|
+
disableRememberMe,
|
|
55
|
+
useCompactIdpPage,
|
|
56
|
+
isSSO
|
|
57
|
+
}).then(({ authorized }) => {
|
|
42
58
|
if (authorized) setUserAuthorized(true);
|
|
43
59
|
dispatch({ type: import_actions.LOGIN_SUCCESS });
|
|
44
60
|
}).catch(() => {
|
|
45
61
|
}).finally(() => {
|
|
46
62
|
ref.current = false;
|
|
47
63
|
});
|
|
48
|
-
}, [
|
|
64
|
+
}, [
|
|
65
|
+
dispatch,
|
|
66
|
+
clientId,
|
|
67
|
+
scope,
|
|
68
|
+
responseType,
|
|
69
|
+
instanceId,
|
|
70
|
+
siteId,
|
|
71
|
+
userId,
|
|
72
|
+
disableRememberMe,
|
|
73
|
+
useCompactIdpPage,
|
|
74
|
+
isSSO
|
|
75
|
+
]);
|
|
49
76
|
return userAuthorized ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : null;
|
|
50
77
|
};
|
|
@@ -45,7 +45,13 @@ const RequireAuth = ({
|
|
|
45
45
|
children,
|
|
46
46
|
clientId = import_constants.default.CLIENT_ID,
|
|
47
47
|
scope = "loc",
|
|
48
|
-
responseType = "code"
|
|
48
|
+
responseType = "code",
|
|
49
|
+
instanceId,
|
|
50
|
+
siteId,
|
|
51
|
+
userId,
|
|
52
|
+
disableRememberMe,
|
|
53
|
+
useCompactIdpPage,
|
|
54
|
+
isSSO
|
|
49
55
|
}) => {
|
|
50
56
|
const AuthManager = (0, import_redux_injectors.createManager)({
|
|
51
57
|
name: "AuthManager",
|
|
@@ -59,5 +65,19 @@ const RequireAuth = ({
|
|
|
59
65
|
(0, import_loginParams.setLoginParams)({ clientId, scope, responseType });
|
|
60
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children });
|
|
61
67
|
}
|
|
62
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_login.Login,
|
|
70
|
+
{
|
|
71
|
+
clientId,
|
|
72
|
+
scope,
|
|
73
|
+
responseType,
|
|
74
|
+
instanceId,
|
|
75
|
+
siteId,
|
|
76
|
+
userId,
|
|
77
|
+
disableRememberMe,
|
|
78
|
+
useCompactIdpPage,
|
|
79
|
+
isSSO,
|
|
80
|
+
children
|
|
81
|
+
}
|
|
82
|
+
) });
|
|
63
83
|
};
|
|
@@ -17,10 +17,18 @@ const auth = {
|
|
|
17
17
|
redirectUri,
|
|
18
18
|
responseType,
|
|
19
19
|
scope,
|
|
20
|
-
code
|
|
20
|
+
code,
|
|
21
|
+
customLogoutUrl
|
|
21
22
|
}) => ({
|
|
22
23
|
type: LOGOUT,
|
|
23
|
-
payload: {
|
|
24
|
+
payload: {
|
|
25
|
+
clientId,
|
|
26
|
+
redirectUri,
|
|
27
|
+
responseType,
|
|
28
|
+
scope,
|
|
29
|
+
code,
|
|
30
|
+
customLogoutUrl
|
|
31
|
+
}
|
|
24
32
|
})
|
|
25
33
|
};
|
|
26
34
|
export {
|
package/dist/esm/package.json
CHANGED
|
@@ -26,19 +26,42 @@ const navigateToLoginPage = ({
|
|
|
26
26
|
redirectUri,
|
|
27
27
|
idpErrorCode,
|
|
28
28
|
scope,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
responseType,
|
|
30
|
+
instanceId,
|
|
31
|
+
siteId,
|
|
32
|
+
userId,
|
|
33
|
+
disableRememberMe,
|
|
34
|
+
useCompactIdpPage,
|
|
35
|
+
isSSO
|
|
31
36
|
}) => {
|
|
32
37
|
const idpHost = getAppConfigValue(IDP_ENDPOINT_CONFIG_KEY, "");
|
|
33
38
|
const idpUrl = new URL("/authorize", idpHost);
|
|
34
39
|
const idpOptions = {
|
|
35
40
|
client_id: clientId,
|
|
36
41
|
redirect_uri: redirectUri,
|
|
37
|
-
response_type: responseType,
|
|
38
|
-
scope
|
|
42
|
+
response_type: responseType ?? "",
|
|
43
|
+
scope,
|
|
44
|
+
...instanceId !== void 0 && {
|
|
45
|
+
instance_id: String(instanceId)
|
|
46
|
+
},
|
|
47
|
+
...siteId !== void 0 && {
|
|
48
|
+
site_id: String(siteId)
|
|
49
|
+
},
|
|
50
|
+
...userId !== void 0 && {
|
|
51
|
+
user_id: userId
|
|
52
|
+
},
|
|
53
|
+
...disableRememberMe !== void 0 && {
|
|
54
|
+
disable_remember_me: String(disableRememberMe)
|
|
55
|
+
},
|
|
56
|
+
...useCompactIdpPage !== void 0 && {
|
|
57
|
+
tpoifr: String(useCompactIdpPage)
|
|
58
|
+
},
|
|
59
|
+
...isSSO !== void 0 && {
|
|
60
|
+
is_sso: String(isSSO)
|
|
61
|
+
}
|
|
39
62
|
};
|
|
40
63
|
const searchParams = new URLSearchParams(
|
|
41
|
-
idpErrorCode ?
|
|
64
|
+
idpErrorCode ? { ...idpOptions, error_code: idpErrorCode } : idpOptions
|
|
42
65
|
);
|
|
43
66
|
idpUrl.search = searchParams.toString();
|
|
44
67
|
window.location.replace(idpUrl.href);
|
|
@@ -49,6 +72,7 @@ const endSession = async ({
|
|
|
49
72
|
responseType,
|
|
50
73
|
scope,
|
|
51
74
|
code = "",
|
|
75
|
+
customLogoutUrl = "",
|
|
52
76
|
skipRevoke = false
|
|
53
77
|
}) => {
|
|
54
78
|
try {
|
|
@@ -62,17 +86,22 @@ const endSession = async ({
|
|
|
62
86
|
});
|
|
63
87
|
logoutEvent();
|
|
64
88
|
setAppDynamicsUserData({ instanceId: "", userId: "" });
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
let logoutUrl;
|
|
90
|
+
if (customLogoutUrl) {
|
|
91
|
+
logoutUrl = new URL("/", customLogoutUrl);
|
|
92
|
+
} else {
|
|
93
|
+
const idpHost = getAppConfigValue(IDP_ENDPOINT_CONFIG_KEY, "");
|
|
94
|
+
logoutUrl = new URL("/authorize", idpHost);
|
|
95
|
+
const params = {
|
|
96
|
+
client_id: clientId,
|
|
97
|
+
redirect_uri: redirectUri,
|
|
98
|
+
...code && { error_code: code },
|
|
99
|
+
response_type: responseType,
|
|
100
|
+
scope
|
|
101
|
+
};
|
|
102
|
+
const searchParams = new URLSearchParams(params);
|
|
103
|
+
logoutUrl.search = searchParams.toString();
|
|
104
|
+
}
|
|
76
105
|
window.location.replace(logoutUrl.href);
|
|
77
106
|
} catch (err) {
|
|
78
107
|
getLogger()?.error({
|
|
@@ -95,7 +124,12 @@ const authorize = async ({
|
|
|
95
124
|
scope,
|
|
96
125
|
redirectUri
|
|
97
126
|
});
|
|
98
|
-
setLoginParams({
|
|
127
|
+
setLoginParams({
|
|
128
|
+
clientId,
|
|
129
|
+
scope,
|
|
130
|
+
responseType,
|
|
131
|
+
redirectUri
|
|
132
|
+
});
|
|
99
133
|
const authorizationToken = `${tokenType} ${accessToken}`;
|
|
100
134
|
setAuthorizationHeader(authorizationToken);
|
|
101
135
|
const introspectResponse = await introspectToken({
|
|
@@ -141,7 +175,13 @@ const authorize = async ({
|
|
|
141
175
|
const login = async ({
|
|
142
176
|
clientId,
|
|
143
177
|
scope,
|
|
144
|
-
responseType
|
|
178
|
+
responseType,
|
|
179
|
+
instanceId,
|
|
180
|
+
siteId,
|
|
181
|
+
userId,
|
|
182
|
+
disableRememberMe,
|
|
183
|
+
useCompactIdpPage,
|
|
184
|
+
isSSO
|
|
145
185
|
}) => {
|
|
146
186
|
const { code, idpErrorCode, redirectUri } = getIDPInfoFromUrl();
|
|
147
187
|
const loginInfo = {
|
|
@@ -150,7 +190,13 @@ const login = async ({
|
|
|
150
190
|
responseType,
|
|
151
191
|
redirectUri,
|
|
152
192
|
code,
|
|
153
|
-
idpErrorCode
|
|
193
|
+
idpErrorCode,
|
|
194
|
+
instanceId,
|
|
195
|
+
siteId,
|
|
196
|
+
userId,
|
|
197
|
+
disableRememberMe,
|
|
198
|
+
useCompactIdpPage,
|
|
199
|
+
isSSO
|
|
154
200
|
};
|
|
155
201
|
if (code) {
|
|
156
202
|
await authorize(loginInfo);
|
|
@@ -7,6 +7,12 @@ const Login = ({
|
|
|
7
7
|
clientId,
|
|
8
8
|
scope,
|
|
9
9
|
responseType,
|
|
10
|
+
instanceId,
|
|
11
|
+
siteId,
|
|
12
|
+
userId,
|
|
13
|
+
disableRememberMe,
|
|
14
|
+
useCompactIdpPage,
|
|
15
|
+
isSSO,
|
|
10
16
|
children
|
|
11
17
|
}) => {
|
|
12
18
|
const [userAuthorized, setUserAuthorized] = useState(false);
|
|
@@ -15,14 +21,35 @@ const Login = ({
|
|
|
15
21
|
useEffect(() => {
|
|
16
22
|
if (ref.current) return;
|
|
17
23
|
ref.current = true;
|
|
18
|
-
login({
|
|
24
|
+
login({
|
|
25
|
+
clientId,
|
|
26
|
+
scope,
|
|
27
|
+
responseType,
|
|
28
|
+
instanceId,
|
|
29
|
+
siteId,
|
|
30
|
+
userId,
|
|
31
|
+
disableRememberMe,
|
|
32
|
+
useCompactIdpPage,
|
|
33
|
+
isSSO
|
|
34
|
+
}).then(({ authorized }) => {
|
|
19
35
|
if (authorized) setUserAuthorized(true);
|
|
20
36
|
dispatch({ type: LOGIN_SUCCESS });
|
|
21
37
|
}).catch(() => {
|
|
22
38
|
}).finally(() => {
|
|
23
39
|
ref.current = false;
|
|
24
40
|
});
|
|
25
|
-
}, [
|
|
41
|
+
}, [
|
|
42
|
+
dispatch,
|
|
43
|
+
clientId,
|
|
44
|
+
scope,
|
|
45
|
+
responseType,
|
|
46
|
+
instanceId,
|
|
47
|
+
siteId,
|
|
48
|
+
userId,
|
|
49
|
+
disableRememberMe,
|
|
50
|
+
useCompactIdpPage,
|
|
51
|
+
isSSO
|
|
52
|
+
]);
|
|
26
53
|
return userAuthorized ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
|
|
27
54
|
};
|
|
28
55
|
export {
|
|
@@ -12,7 +12,13 @@ const RequireAuth = ({
|
|
|
12
12
|
children,
|
|
13
13
|
clientId = enums.CLIENT_ID,
|
|
14
14
|
scope = "loc",
|
|
15
|
-
responseType = "code"
|
|
15
|
+
responseType = "code",
|
|
16
|
+
instanceId,
|
|
17
|
+
siteId,
|
|
18
|
+
userId,
|
|
19
|
+
disableRememberMe,
|
|
20
|
+
useCompactIdpPage,
|
|
21
|
+
isSSO
|
|
16
22
|
}) => {
|
|
17
23
|
const AuthManager = createManager({
|
|
18
24
|
name: "AuthManager",
|
|
@@ -26,7 +32,21 @@ const RequireAuth = ({
|
|
|
26
32
|
setLoginParams({ clientId, scope, responseType });
|
|
27
33
|
return /* @__PURE__ */ jsx(AuthManager, { children });
|
|
28
34
|
}
|
|
29
|
-
return /* @__PURE__ */ jsx(AuthManager, { children: /* @__PURE__ */ jsx(
|
|
35
|
+
return /* @__PURE__ */ jsx(AuthManager, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
Login,
|
|
37
|
+
{
|
|
38
|
+
clientId,
|
|
39
|
+
scope,
|
|
40
|
+
responseType,
|
|
41
|
+
instanceId,
|
|
42
|
+
siteId,
|
|
43
|
+
userId,
|
|
44
|
+
disableRememberMe,
|
|
45
|
+
useCompactIdpPage,
|
|
46
|
+
isSSO,
|
|
47
|
+
children
|
|
48
|
+
}
|
|
49
|
+
) });
|
|
30
50
|
};
|
|
31
51
|
export {
|
|
32
52
|
RequireAuth
|
|
@@ -15,8 +15,9 @@ export interface LogoutParams {
|
|
|
15
15
|
responseType: string;
|
|
16
16
|
scope: string;
|
|
17
17
|
code: string;
|
|
18
|
+
customLogoutUrl: string;
|
|
18
19
|
}
|
|
19
20
|
export declare const auth: {
|
|
20
21
|
login: ({ code, redirectUri, clientId, responseType, scope, }: LoginParms) => PayloadAction<LoginParms>;
|
|
21
|
-
logout: ({ clientId, redirectUri, responseType, scope, code, }: LogoutParams) => PayloadAction<LogoutParams>;
|
|
22
|
+
logout: ({ clientId, redirectUri, responseType, scope, code, customLogoutUrl, }: LogoutParams) => PayloadAction<LogoutParams>;
|
|
22
23
|
};
|
|
@@ -5,12 +5,41 @@ export declare const getIDPInfoFromUrl: () => {
|
|
|
5
5
|
idpErrorCode: string;
|
|
6
6
|
redirectUri: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Navigates the user to the login page of IDP with the specified
|
|
10
|
+
* authentication parameters.
|
|
11
|
+
*
|
|
12
|
+
* Constructs the authorization URL using the provided options and
|
|
13
|
+
* redirects the browser to initiate the login flow.
|
|
14
|
+
* @param options - An object containing authentication parameters:
|
|
15
|
+
* @param options.clientId - The client identifier for the application.
|
|
16
|
+
* @param options.redirectUri - The URI to redirect to after authentication.
|
|
17
|
+
* @param options.idpErrorCode - Optional error code to pass to the IDP.
|
|
18
|
+
* @param options.scope - The scope of the authentication request.
|
|
19
|
+
* @param options.responseType - Optional response type for the
|
|
20
|
+
* authentication request.
|
|
21
|
+
* @param options.instanceId - Optional instance identifier.
|
|
22
|
+
* @param options.siteId - Optional site identifier.
|
|
23
|
+
* @param options.userId - Optional user identifier.
|
|
24
|
+
* @param options.disableRememberMe - Optional flag to disable
|
|
25
|
+
* "Remember Me" functionality.
|
|
26
|
+
* @param options.useCompactIdpPage - Optional flag. Determines whether to use a
|
|
27
|
+
* compact or full IDP page.
|
|
28
|
+
* @param options.isSSO - Optional flag. Determines whether to use
|
|
29
|
+
* SSO or not
|
|
30
|
+
*/
|
|
31
|
+
export declare const navigateToLoginPage: ({ clientId, redirectUri, idpErrorCode, scope, responseType, instanceId, siteId, userId, disableRememberMe, useCompactIdpPage, isSSO, }: {
|
|
9
32
|
clientId: string;
|
|
10
33
|
redirectUri: string;
|
|
11
34
|
idpErrorCode: string;
|
|
12
35
|
scope: string;
|
|
13
|
-
responseType
|
|
36
|
+
responseType?: string;
|
|
37
|
+
instanceId?: number;
|
|
38
|
+
siteId?: number;
|
|
39
|
+
userId?: string;
|
|
40
|
+
disableRememberMe?: boolean;
|
|
41
|
+
useCompactIdpPage?: boolean;
|
|
42
|
+
isSSO?: boolean;
|
|
14
43
|
}) => void;
|
|
15
44
|
export declare const endSession: EndSessionFn;
|
|
16
45
|
export declare const authorize: ({ code, redirectUri, clientId, scope, responseType, }: {
|
|
@@ -20,10 +49,36 @@ export declare const authorize: ({ code, redirectUri, clientId, scope, responseT
|
|
|
20
49
|
scope: string;
|
|
21
50
|
responseType: string;
|
|
22
51
|
}) => Promise<void>;
|
|
23
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Attempts to log in a user using the provided authentication parameters.
|
|
54
|
+
*
|
|
55
|
+
* If an authorization code is present in the URL, it calls the `authorize`
|
|
56
|
+
* function with the login information and returns `{ authorized: true }`.
|
|
57
|
+
* Otherwise, it navigates to the login page and returns `{ authorized: false }`.
|
|
58
|
+
* @param params - The authentication parameters.
|
|
59
|
+
* @param params.clientId - The client identifier for the authentication request.
|
|
60
|
+
* @param params.scope - The scope of the authentication request.
|
|
61
|
+
* @param params.responseType - The response type for the authentication request.
|
|
62
|
+
* @param params.instanceId - (Optional) The instance identifier.
|
|
63
|
+
* @param params.siteId - (Optional) The site identifier.
|
|
64
|
+
* @param params.userId - (Optional) The user identifier.
|
|
65
|
+
* @param params.disableRememberMe - (Optional) Whether to disable the
|
|
66
|
+
* "Remember Me" option.
|
|
67
|
+
* @param params.useCompactIdpPage - (Optional). Determines whether to use a compact or
|
|
68
|
+
* full IDP page.
|
|
69
|
+
* @param params.isSSO - (Optional). Determines whether to use SSO or not.
|
|
70
|
+
* @returns An object indicating whether the user is authorized.
|
|
71
|
+
*/
|
|
72
|
+
export declare const login: ({ clientId, scope, responseType, instanceId, siteId, userId, disableRememberMe, useCompactIdpPage, isSSO, }: {
|
|
24
73
|
clientId: string;
|
|
25
74
|
scope: string;
|
|
26
75
|
responseType: string;
|
|
76
|
+
instanceId?: number;
|
|
77
|
+
siteId?: number;
|
|
78
|
+
userId?: string;
|
|
79
|
+
disableRememberMe?: boolean;
|
|
80
|
+
useCompactIdpPage?: boolean;
|
|
81
|
+
isSSO?: boolean;
|
|
27
82
|
}) => Promise<{
|
|
28
83
|
authorized: boolean;
|
|
29
84
|
}>;
|
|
@@ -2,7 +2,34 @@ interface LoginParams {
|
|
|
2
2
|
clientId: string;
|
|
3
3
|
scope: string;
|
|
4
4
|
responseType: string;
|
|
5
|
+
instanceId?: number;
|
|
6
|
+
siteId?: number;
|
|
7
|
+
userId?: string;
|
|
8
|
+
disableRememberMe?: boolean;
|
|
9
|
+
useCompactIdpPage?: boolean;
|
|
10
|
+
isSSO?: boolean;
|
|
5
11
|
children: React.ReactNode;
|
|
6
12
|
}
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Renders the login flow for the application and manages user authorization
|
|
15
|
+
* state.
|
|
16
|
+
*
|
|
17
|
+
* This component triggers a login process using the provided parameters and,
|
|
18
|
+
* upon successful authorization, renders its children.
|
|
19
|
+
* @param clientId - The client identifier for authentication.
|
|
20
|
+
* @param scope - The scope of authentication request.
|
|
21
|
+
* @param responseType - The type of response expected.
|
|
22
|
+
* @param instanceId - (optional) The instance identifier for the login context.
|
|
23
|
+
* @param siteId - (optional) The site identifier for the login context.
|
|
24
|
+
* @param userId - (optional) The identifier of the user attempting to log in.
|
|
25
|
+
* @param disableRememberMe - (optional) If true, disables the "Remember Me"
|
|
26
|
+
* option.
|
|
27
|
+
* @param useCompactIdpPage - (optional) Determines whether to use a compact or full IDP
|
|
28
|
+
* page.
|
|
29
|
+
* @param isSSO - (optional) Determines whether to use SSO or not.
|
|
30
|
+
* @param children - React elements to render upon successful authorization.
|
|
31
|
+
* @returns The children elements if the user is authorized; otherwise, returns
|
|
32
|
+
* null.
|
|
33
|
+
*/
|
|
34
|
+
export declare const Login: ({ clientId, scope, responseType, instanceId, siteId, userId, disableRememberMe, useCompactIdpPage, isSSO, children, }: LoginParams) => import("react/jsx-runtime.js").JSX.Element | null;
|
|
8
35
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,34 @@ export interface RequireAuthProps {
|
|
|
2
2
|
clientId?: string;
|
|
3
3
|
scope?: string;
|
|
4
4
|
responseType?: string;
|
|
5
|
+
instanceId?: number;
|
|
6
|
+
siteId?: number;
|
|
7
|
+
userId?: string;
|
|
8
|
+
disableRememberMe?: boolean;
|
|
9
|
+
useCompactIdpPage?: boolean;
|
|
10
|
+
isSSO?: boolean;
|
|
5
11
|
children: React.ReactNode;
|
|
6
12
|
}
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A React component that ensures authentication for its children.
|
|
15
|
+
*
|
|
16
|
+
* If the user is authorized, it renders the children within the AuthManager
|
|
17
|
+
* context. Otherwise, it renders the Login component to prompt for
|
|
18
|
+
* authentication, passing relevant props.
|
|
19
|
+
* @param children - The child components to render, which require
|
|
20
|
+
* authentication.
|
|
21
|
+
* @param clientId - The client identifier for authentication. Defaults to
|
|
22
|
+
* `enums.CLIENT_ID`.
|
|
23
|
+
* @param scope - The scope of authentication. Defaults to `'loc'`.
|
|
24
|
+
* @param responseType - The response type for authentication. Defaults to
|
|
25
|
+
* `'code'`.
|
|
26
|
+
* @param instanceId - Optional instance identifier.
|
|
27
|
+
* @param siteId - Optional site identifier.
|
|
28
|
+
* @param userId - Optional user identifier for authentication.
|
|
29
|
+
* @param disableRememberMe - Optional flag to disable the "Remember Me"
|
|
30
|
+
* feature.
|
|
31
|
+
* @param useCompactIdpPage - Optional flag. Determines whether to use a compact or full
|
|
32
|
+
* IDP page.
|
|
33
|
+
* @param isSSO - Optional flag. Determines whether to use SSO or not.
|
|
34
|
+
*/
|
|
35
|
+
export declare const RequireAuth: ({ children, clientId, scope, responseType, instanceId, siteId, userId, disableRememberMe, useCompactIdpPage, isSSO, }: RequireAuthProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|