Skip to content

Commit d00a6b7

Browse files
Merge pull request #335 from appukuttan-shailesh/ebrains_theme
EBRAINS theme + Other improvements & Fixes
2 parents 0f62a04 + d44c2e3 commit d00a6b7

39 files changed

+5685
-12819
lines changed

apps/curation-dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@testing-library/react": "^11.2.5",
1111
"@testing-library/user-event": "^12.8.1",
1212
"axios": "^0.21.1",
13-
"keycloak-js": "^8.0.1",
13+
"keycloak-js": "^12.0.2",
1414
"react": "^17.0.1",
1515
"react-dom": "^17.0.1",
1616
"react-scripts": "4.0.3"

apps/curation-dashboard/src/auth.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,34 @@ import Keycloak from 'keycloak-js';
66
const keycloak = Keycloak({
77
url: 'https://iam.ebrains.eu/auth',
88
realm: 'hbp',
9-
clientId: 'model-catalog'
9+
clientId: 'model-catalog',
10+
'public-client': true,
11+
'confidential-port': 0,
1012
});
1113
const YOUR_APP_SCOPES = 'team email profile'; // full list at https://iam.ebrains.eu/auth/realms/hbp/.well-known/openid-configuration
1214

1315

1416
export default function initAuth(main) {
1517
console.log('DOM content is loaded, initialising Keycloak client...');
16-
keycloak
17-
.init({ flow: 'implicit', promiseType: 'native' })
18+
console.log(window.location.hostname);
19+
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
20+
// for local development
21+
keycloak
22+
.init({ flow: 'implicit', promiseType: 'native' })
1823
.then(() => checkAuth(main))
1924
.catch(console.log);
25+
} else {
26+
// for deployment
27+
keycloak
28+
.init({ flow: 'standard', pkceMethod: 'S256' })
29+
.then(() => checkAuth(main))
30+
.catch(console.log);
31+
}
2032
}
2133

22-
2334
function checkPermissions(keycloak) {
2435
return keycloak.loadUserInfo()
2536
.then((userInfo) => {
26-
2737
if (userInfo.roles.team.includes("collab-model-validation-editor") || userInfo.roles.team.includes("collab-model-validation-administrator")) {
2838
keycloak.authorized = true;
2939
} else {
@@ -32,7 +42,6 @@ function checkPermissions(keycloak) {
3242
})
3343
}
3444

35-
3645
function checkAuth(main) {
3746
console.log('Keycloak client is initialised, verifying authentication...');
3847

apps/validation_framework_v2/package-lock.json

Lines changed: 4036 additions & 11691 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/validation_framework_v2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"eslint-plugin-react-hooks": "^4.2.0",
1515
"filesize": "^6.1.0",
1616
"humanparser": "^1.11.0",
17-
"keycloak-js": "^8.0.1",
17+
"keycloak-js": "^12.0.2",
1818
"lodash": "^4.17.20",
1919
"material-ui-chip-input": "^2.0.0-beta.2",
2020
"moment": "^2.29.1",
Lines changed: 108 additions & 0 deletions
Loading
Binary file not shown.

0 commit comments

Comments
 (0)