Skip to content
Snippets Groups Projects
Commit c22dc6da authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Try again: Add attribute for forwarding the keycloak config

No longer depend on env.js to select the right config but require it
to be passed explicitely in the attributes.
parent 2211a358
Branches
No related tags found
No related merge requests found
...@@ -14,10 +14,11 @@ activities. Handles login, language selection, activity switching, menus etc. ...@@ -14,10 +14,11 @@ activities. Handles login, language selection, activity switching, menus etc.
## Attributes ## Attributes
- `lang` (optional, default: `de`): set to `de` or `en` for German or English - `lang` (optional, default: `de`): set to `de` or `en` for German or English
- example `<vpu-auth lang="de" </vpu-auth>` - example `<vpu-app-shell lang="de" </vpu-app-shell>`
- `src`: The path to a topic metadata file (json) - `src`: The path to a topic metadata file (json)
- `base-path` (optional, default: `/`: An absolute base path for routing - `base-path` (optional, default: `/`: An absolute base path for routing
- `entry-point-url`: Entry point URL to access the API - `entry-point-url`: Entry point URL to access the API
- `keycloak-config`: See `vpu-auth` for details
## Topic Metadata ## Topic Metadata
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<body> <body>
<vpu-app-shell src="/example.topic.metadata.json"></vpu-app-shell> <vpu-app-shell keycloak-config='{"url": "https://auth-dev.tugraz.at/auth", "realm": "tugraz", "clientId": "auth-dev-mw-frontend-local", "silentCheckSsoRedirectUri": "/silent-check-sso.html"}' src="/example.topic.metadata.json"></vpu-app-shell>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,8 +5,8 @@ import {LanguageSelect} from 'vpu-language-select'; ...@@ -5,8 +5,8 @@ import {LanguageSelect} from 'vpu-language-select';
import {Icon} from 'vpu-common'; import {Icon} from 'vpu-common';
import {Auth} from 'vpu-auth'; import {Auth} from 'vpu-auth';
import {Notification} from 'vpu-notification'; import {Notification} from 'vpu-notification';
import * as commonUtils from 'vpu-common/utils';
import * as commonStyles from 'vpu-common/styles'; import * as commonStyles from 'vpu-common/styles';
import * as commonUtils from 'vpu-common/utils';
import buildinfo from 'consts:buildinfo'; import buildinfo from 'consts:buildinfo';
import {classMap} from 'lit-html/directives/class-map.js'; import {classMap} from 'lit-html/directives/class-map.js';
import {Router} from './router.js'; import {Router} from './router.js';
...@@ -54,6 +54,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -54,6 +54,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
this.metadata = {}; this.metadata = {};
this.topic = {}; this.topic = {};
this.basePath = '/'; this.basePath = '/';
this.keycloakConfig = null;
this._updateAuth = this._updateAuth.bind(this); this._updateAuth = this._updateAuth.bind(this);
this._loginStatus = 'unknown'; this._loginStatus = 'unknown';
...@@ -218,6 +219,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -218,6 +219,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
basePath: { type: String, attribute: 'base-path' }, basePath: { type: String, attribute: 'base-path' },
activeView: { type: String, attribute: false}, activeView: { type: String, attribute: false},
entryPointUrl: { type: String, attribute: 'entry-point-url' }, entryPointUrl: { type: String, attribute: 'entry-point-url' },
keycloakConfig: { type: Object, attribute: 'keycloak-config' },
metadata: { type: Object, attribute: false }, metadata: { type: Object, attribute: false },
topic: { type: Object, attribute: false }, topic: { type: Object, attribute: false },
subtitle: { type: String, attribute: false }, subtitle: { type: String, attribute: false },
...@@ -637,8 +639,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -637,8 +639,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
} }
render() { render() {
const silentCheckSsoUri = commonUtils.getAssetURL('silent-check-sso.html');
const getSelectClasses = (name => { const getSelectClasses = (name => {
return classMap({selected: this.activeView === name}); return classMap({selected: this.activeView === name});
}); });
...@@ -685,7 +685,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) { ...@@ -685,7 +685,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
<div class="hd1-middle"> <div class="hd1-middle">
</div> </div>
<div class="hd1-right"> <div class="hd1-right">
<vpu-auth lang="${this.lang}" show-profile keycloak-config='{"clientId": "${commonUtils.setting('keyCloakClientId')}", "silentCheckSsoRedirectUri": "${silentCheckSsoUri}"}' load-person try-login></vpu-auth> <vpu-auth lang="${this.lang}" show-profile keycloak-config="${JSON.stringify(this.keycloakConfig)}" load-person try-login></vpu-auth>
</div> </div>
<div class="hd2-left"> <div class="hd2-left">
<div class="header"> <div class="header">
......
...@@ -48,7 +48,7 @@ class AppShellUserProfile extends ScopedElementsMixin(LitElement) { ...@@ -48,7 +48,7 @@ class AppShellUserProfile extends ScopedElementsMixin(LitElement) {
render() { render() {
return html` return html`
<vpu-person-profile value="${this._personId}" entry-point-url="${this.entryPointUrl}"" lang="${this.lang}"></vpu-person-profile> <vpu-person-profile value="${this._personId}" entry-point-url="${this.entryPointUrl}" lang="${this.lang}"></vpu-person-profile>
`; `;
} }
} }
......
auth @ 2e179331
Subproject commit b9fbe487a8a6117ae90a423a8ba318a0321bf51b Subproject commit 2e179331c2f7572a85e98c825736a3c93494e1ea
person-profile @ 5cb9000f
Subproject commit 8158d8451e08bfaf495ee263d208a448df83e12d Subproject commit 5cb9000f7ae43558b3db7df4b61f3bb177f02fe2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment