@beinformed/ui 1.27.2 → 1.27.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/CHANGELOG.md +8 -0
- package/esm/constants/Constants.js +5 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/constants/Settings.js +6 -4
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +6 -3
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +25 -13
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/react/ErrorBoundaryFallback.js +3 -0
- package/esm/react/ErrorBoundaryFallback.js.map +1 -1
- package/esm/react-server/serverUtil.js +1 -0
- package/esm/react-server/serverUtil.js.map +1 -1
- package/lib/constants/Constants.js +7 -1
- package/lib/constants/Constants.js.flow +5 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/Settings.js +5 -3
- package/lib/constants/Settings.js.flow +7 -3
- package/lib/constants/Settings.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +6 -3
- package/lib/models/application/ApplicationModel.js.flow +10 -5
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +24 -12
- package/lib/modularui/Authenticate.js.flow +30 -13
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js +3 -0
- package/lib/react/ErrorBoundaryFallback.js.flow +2 -0
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-server/serverUtil.js +1 -0
- package/lib/react-server/serverUtil.js.flow +2 -0
- package/lib/react-server/serverUtil.js.map +1 -1
- package/package.json +3 -3
- package/src/constants/Constants.js +5 -0
- package/src/constants/Settings.js +7 -3
- package/src/models/application/ApplicationModel.js +10 -5
- package/src/modularui/Authenticate.js +30 -13
- package/src/react/ErrorBoundaryFallback.js +2 -0
- package/src/react-server/serverUtil.js +2 -0
- package/types/constants/Constants.d.ts +5 -0
- package/types/modularui/Authenticate.d.ts +8 -1
|
@@ -80,12 +80,17 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
80
80
|
DEFAULT_AUTHENTICATION_TYPE,
|
|
81
81
|
]);
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
a
|
|
87
|
-
|
|
83
|
+
if (authenticationTypes) {
|
|
84
|
+
//put primary first
|
|
85
|
+
return authenticationTypes?.sort(
|
|
86
|
+
(a: AuthenticationType, b: AuthenticationType) =>
|
|
87
|
+
a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return [DEFAULT_AUTHENTICATION_TYPE];
|
|
88
92
|
}
|
|
93
|
+
|
|
89
94
|
/**
|
|
90
95
|
* Getting the tab links
|
|
91
96
|
*/
|
|
@@ -6,6 +6,7 @@ import Cache from "../utils/browser/Cache";
|
|
|
6
6
|
|
|
7
7
|
import { UnauthorizedException } from "../exceptions";
|
|
8
8
|
import {
|
|
9
|
+
INTERNAL_LOGIN_TYPE,
|
|
9
10
|
loginType,
|
|
10
11
|
loginPath,
|
|
11
12
|
loginPasswordField,
|
|
@@ -27,16 +28,17 @@ class Authenticate {
|
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
*/
|
|
30
|
-
get authenticationType():
|
|
31
|
+
get authenticationType(): $Keys<typeof INTERNAL_LOGIN_TYPE> {
|
|
31
32
|
const type = loginType();
|
|
32
33
|
|
|
33
|
-
if (!type || type ===
|
|
34
|
-
return
|
|
34
|
+
if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {
|
|
35
|
+
return INTERNAL_LOGIN_TYPE.JAAS;
|
|
35
36
|
}
|
|
37
|
+
|
|
36
38
|
if (type.includes("FormClient")) {
|
|
37
|
-
return
|
|
39
|
+
return INTERNAL_LOGIN_TYPE.PAC4J_FORM;
|
|
38
40
|
} else if (type.includes("BasicClient")) {
|
|
39
|
-
return
|
|
41
|
+
return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
throw new Error(`Unsupported login type found: ${type}`);
|
|
@@ -45,7 +47,10 @@ class Authenticate {
|
|
|
45
47
|
/**
|
|
46
48
|
*/
|
|
47
49
|
get isBasicAuthentication(): boolean {
|
|
48
|
-
return
|
|
50
|
+
return (
|
|
51
|
+
this._isBasic ||
|
|
52
|
+
this.authenticationType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC
|
|
53
|
+
);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
/**
|
|
@@ -90,9 +95,9 @@ class Authenticate {
|
|
|
90
95
|
*/
|
|
91
96
|
login(username: string, password: string): Promise<any> {
|
|
92
97
|
switch (this.authenticationType) {
|
|
93
|
-
case
|
|
98
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
94
99
|
return this.doFormLogin(username, password);
|
|
95
|
-
case
|
|
100
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
96
101
|
return this.doBasicAuthentication(username, password);
|
|
97
102
|
default:
|
|
98
103
|
return this.doJaasAuthentication(username, password);
|
|
@@ -103,8 +108,8 @@ class Authenticate {
|
|
|
103
108
|
*/
|
|
104
109
|
getFormLoginUrl(): string {
|
|
105
110
|
switch (this.authenticationType) {
|
|
106
|
-
case
|
|
107
|
-
case
|
|
111
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
112
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
108
113
|
return `${getBasePath()}${loginPath()}`;
|
|
109
114
|
default:
|
|
110
115
|
return `${getBasePath()}/j_security_check`;
|
|
@@ -118,8 +123,8 @@ class Authenticate {
|
|
|
118
123
|
const encodedPassword = encodeURIComponent(password);
|
|
119
124
|
|
|
120
125
|
switch (this.authenticationType) {
|
|
121
|
-
case
|
|
122
|
-
case
|
|
126
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
127
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
123
128
|
return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;
|
|
124
129
|
default:
|
|
125
130
|
return `j_username=${encodedUsername}&j_password=${encodedPassword}`;
|
|
@@ -158,11 +163,23 @@ class Authenticate {
|
|
|
158
163
|
});
|
|
159
164
|
}
|
|
160
165
|
|
|
166
|
+
/**
|
|
167
|
+
*/
|
|
168
|
+
getLogoutUrl(): string {
|
|
169
|
+
switch (this.authenticationType) {
|
|
170
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
171
|
+
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
172
|
+
return `${getBasePath()}${logoutPath()}`;
|
|
173
|
+
default:
|
|
174
|
+
return `${getBasePath()}/Logoff`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
161
178
|
/**
|
|
162
179
|
*/
|
|
163
180
|
logout(): Promise<any> {
|
|
164
181
|
return universalFetch({
|
|
165
|
-
url:
|
|
182
|
+
url: this.getLogoutUrl(),
|
|
166
183
|
}).then((response) => {
|
|
167
184
|
// clear cache because of cached contributions
|
|
168
185
|
Cache.clear();
|
|
@@ -12,6 +12,7 @@ export type Props = {
|
|
|
12
12
|
+error: Error,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
// $FlowFixMe
|
|
15
16
|
const StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`
|
|
16
17
|
padding: ${spacers(2, 1)};
|
|
17
18
|
margin-bottom: ${spacer(2)};
|
|
@@ -19,6 +20,7 @@ const StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`
|
|
|
19
20
|
border-radius: 0.3em;
|
|
20
21
|
`;
|
|
21
22
|
|
|
23
|
+
// $FlowFixMe
|
|
22
24
|
const StyledStack = styled.pre`
|
|
23
25
|
display: block;
|
|
24
26
|
font-size: 87.5%;
|
|
@@ -128,6 +128,11 @@ export namespace ATTRIBUTE_WIDTH {
|
|
|
128
128
|
const EXTRA_LARGE: string;
|
|
129
129
|
}
|
|
130
130
|
export const ALL_CONTENT_IN_DATA_SETTING: "hasAllContentInData";
|
|
131
|
+
export namespace INTERNAL_LOGIN_TYPE {
|
|
132
|
+
const JAAS: string;
|
|
133
|
+
const PAC4J_FORM: string;
|
|
134
|
+
const PAC4J_BASIC: string;
|
|
135
|
+
}
|
|
131
136
|
export const LOGIN_TYPE: "security.clients";
|
|
132
137
|
export const LOGIN_PATH_SETTING: "FormClient.login_url";
|
|
133
138
|
export const LOGIN_USERNAME_SETTING: "FormClient.username_field_name";
|
|
@@ -5,7 +5,11 @@ declare class Authenticate {
|
|
|
5
5
|
_isBasic: boolean;
|
|
6
6
|
/**
|
|
7
7
|
*/
|
|
8
|
-
get authenticationType():
|
|
8
|
+
get authenticationType(): $Keys<{
|
|
9
|
+
JAAS: string;
|
|
10
|
+
PAC4J_FORM: string;
|
|
11
|
+
PAC4J_BASIC: string;
|
|
12
|
+
}>;
|
|
9
13
|
/**
|
|
10
14
|
*/
|
|
11
15
|
set isBasicAuthentication(arg: boolean);
|
|
@@ -36,6 +40,9 @@ declare class Authenticate {
|
|
|
36
40
|
/**
|
|
37
41
|
*/
|
|
38
42
|
doJaasAuthentication(username: string, password: string): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
*/
|
|
45
|
+
getLogoutUrl(): string;
|
|
39
46
|
/**
|
|
40
47
|
*/
|
|
41
48
|
logout(): Promise<any>;
|