Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/curation-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.1",
"axios": "^0.21.1",
"keycloak-js": "^8.0.1",
"keycloak-js": "^12.0.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3"
Expand Down
21 changes: 15 additions & 6 deletions apps/curation-dashboard/src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,34 @@ import Keycloak from 'keycloak-js';
const keycloak = Keycloak({
url: 'https://iam.ebrains.eu/auth',
realm: 'hbp',
clientId: 'model-catalog'
clientId: 'model-catalog',
'public-client': true,
'confidential-port': 0,
});
const YOUR_APP_SCOPES = 'team email profile'; // full list at https://iam.ebrains.eu/auth/realms/hbp/.well-known/openid-configuration


export default function initAuth(main) {
console.log('DOM content is loaded, initialising Keycloak client...');
keycloak
.init({ flow: 'implicit', promiseType: 'native' })
console.log(window.location.hostname);
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
// for local development
keycloak
.init({ flow: 'implicit', promiseType: 'native' })
.then(() => checkAuth(main))
.catch(console.log);
} else {
// for deployment
keycloak
.init({ flow: 'standard', pkceMethod: 'S256' })
.then(() => checkAuth(main))
.catch(console.log);
}
}


function checkPermissions(keycloak) {
return keycloak.loadUserInfo()
.then((userInfo) => {

if (userInfo.roles.team.includes("collab-model-validation-editor") || userInfo.roles.team.includes("collab-model-validation-administrator")) {
keycloak.authorized = true;
} else {
Expand All @@ -32,7 +42,6 @@ function checkPermissions(keycloak) {
})
}


function checkAuth(main) {
console.log('Keycloak client is initialised, verifying authentication...');

Expand Down
15,727 changes: 4,036 additions & 11,691 deletions apps/validation_framework_v2/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/validation_framework_v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"eslint-plugin-react-hooks": "^4.2.0",
"filesize": "^6.1.0",
"humanparser": "^1.11.0",
"keycloak-js": "^8.0.1",
"keycloak-js": "^12.0.2",
"lodash": "^4.17.20",
"material-ui-chip-input": "^2.0.0-beta.2",
"moment": "^2.29.1",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading