Skip to content
Snippets Groups Projects
Unverified Commit dcf43d44 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Integrate entryPointUrl for AuthKeycloak

parent cfc95f4b
No related branches found
No related tags found
No related merge requests found
Pipeline #16205 failed
Showing
with 35 additions and 26 deletions
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<body> <body>
<dbp-auth-demo lang="de"></dbp-auth-demo> <dbp-auth-demo lang="de" entry-point-url="http://127.0.0.1:8000"></dbp-auth-demo>
</body> </body>
</html> </html>
import {i18n} from './i18n.js'; import {i18n} from './i18n.js';
import {html, LitElement} from 'lit-element'; import {html} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {AuthKeycloak} from './auth-keycloak.js'; import {AuthKeycloak} from './auth-keycloak.js';
import {LoginButton} from './login-button.js'; import {LoginButton} from './login-button.js';
import * as commonUtils from '@dbp-toolkit/common/utils'; import * as commonUtils from '@dbp-toolkit/common/utils';
import {name as pkgName} from './../package.json'; import {name as pkgName} from './../package.json';
import DBPLitElement from "@dbp-toolkit/common/dbp-lit-element";
class AuthDemo extends ScopedElementsMixin(LitElement) { class AuthDemo extends ScopedElementsMixin(DBPLitElement) {
constructor() { constructor() {
super(); super();
this.lang = 'de'; this.lang = 'de';
this.entryPointUrl = '';
} }
static get scopedElements() { static get scopedElements() {
...@@ -20,9 +22,10 @@ class AuthDemo extends ScopedElementsMixin(LitElement) { ...@@ -20,9 +22,10 @@ class AuthDemo extends ScopedElementsMixin(LitElement) {
} }
static get properties() { static get properties() {
return { return this.getProperties({
lang: { type: String }, lang: { type: String },
}; entryPointUrl: { type: String, attribute: 'entry-point-url' },
});
} }
update(changedProperties) { update(changedProperties) {
...@@ -91,7 +94,7 @@ class AuthDemo extends ScopedElementsMixin(LitElement) { ...@@ -91,7 +94,7 @@ class AuthDemo extends ScopedElementsMixin(LitElement) {
<h1 class="title">Auth-Demo</h1> <h1 class="title">Auth-Demo</h1>
</div> </div>
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" url="https://auth-dev.tugraz.at/auth" realm="tugraz" client-id="auth-dev-mw-frontend-local" silent-check-sso-redirect-uri="${silentCheckSsoUri}" scope="optional-test-scope" load-person try-login></dbp-auth-keycloak> <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="https://auth-dev.tugraz.at/auth" realm="tugraz" client-id="auth-dev-mw-frontend-local" silent-check-sso-redirect-uri="${silentCheckSsoUri}" scope="optional-test-scope" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
</div> </div>
......
...@@ -56,7 +56,7 @@ export class CheckInPlaceSelectDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -56,7 +56,7 @@ export class CheckInPlaceSelectDemo extends ScopedElementsMixin(DBPLitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
<body> <body>
<dbp-data-table-view-demo lang="de"></dbp-data-table-view-demo> <dbp-data-table-view-demo lang="de" entry-point-url="http://127.0.0.1:8000"></dbp-data-table-view-demo>
</body> </body>
</html> </html>
...@@ -10,6 +10,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) { ...@@ -10,6 +10,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) {
constructor() { constructor() {
super(); super();
this.lang = 'de'; this.lang = 'de';
this.entryPointUrl = '';
this.noAuth = false; this.noAuth = false;
} }
...@@ -22,10 +23,11 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) { ...@@ -22,10 +23,11 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) {
} }
static get properties() { static get properties() {
return { return this.getProperties({
lang: { type: String }, lang: { type: String },
entryPointUrl: { type: String, attribute: 'entry-point-url' },
noAuth: { type: Boolean, attribute: 'no-auth' }, noAuth: { type: Boolean, attribute: 'no-auth' },
}; });
} }
connectedCallback() { connectedCallback() {
...@@ -137,7 +139,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) { ...@@ -137,7 +139,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(LitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -70,7 +70,7 @@ export class KnowledgeBaseWebPageElementViewDemo extends ScopedElementsMixin(DBP ...@@ -70,7 +70,7 @@ export class KnowledgeBaseWebPageElementViewDemo extends ScopedElementsMixin(DBP
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<body> <body>
<dbp-matomo-demo lang="de" matomo-url="<%= matomoUrl %>" matomo-site-id="<%= matomoSiteId %>"></dbp-matomo-demo> <dbp-matomo-demo lang="de" entry-point-url="http://127.0.0.1:8000" matomo-url="<%= matomoUrl %>" matomo-site-id="<%= matomoSiteId %>"></dbp-matomo-demo>
<p>version: <span style="color: white; background-color: black;"><%= buildInfo.info %></span></p> <p>version: <span style="color: white; background-color: black;"><%= buildInfo.info %></span></p>
<p>Matomo: url: <%= matomoUrl %>, site-id: <%= matomoSiteId %></p> <p>Matomo: url: <%= matomoUrl %>, site-id: <%= matomoSiteId %></p>
......
import {i18n} from './i18n.js'; import {i18n} from './i18n.js';
import {css, html, LitElement} from 'lit-element'; import {css, html} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {AuthKeycloak, LoginButton} from '@dbp-toolkit/auth'; import {AuthKeycloak, LoginButton} from '@dbp-toolkit/auth';
import * as commonUtils from '@dbp-toolkit/common/utils'; import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles'; import * as commonStyles from '@dbp-toolkit/common/styles';
import {MatomoElement} from './matomo'; import {MatomoElement} from './matomo';
import DBPLitElement from "@dbp-toolkit/common/dbp-lit-element";
export class MatomoDemo extends ScopedElementsMixin(LitElement) { export class MatomoDemo extends ScopedElementsMixin(DBPLitElement) {
constructor() { constructor() {
super(); super();
this.lang = 'de'; this.lang = 'de';
this.entryPointUrl = '';
this.matomoUrl = ''; this.matomoUrl = '';
this.matomoSiteId = -1; this.matomoSiteId = -1;
this.noAuth = false; this.noAuth = false;
...@@ -26,12 +28,13 @@ export class MatomoDemo extends ScopedElementsMixin(LitElement) { ...@@ -26,12 +28,13 @@ export class MatomoDemo extends ScopedElementsMixin(LitElement) {
} }
static get properties() { static get properties() {
return { return this.getProperties({
lang: { type: String }, lang: { type: String },
entryPointUrl: { type: String, attribute: 'entry-point-url' },
matomoUrl: { type: String, attribute: "matomo-url" }, matomoUrl: { type: String, attribute: "matomo-url" },
matomoSiteId: { type: Number, attribute: "matomo-site-id" }, matomoSiteId: { type: Number, attribute: "matomo-site-id" },
noAuth: { type: Boolean, attribute: 'no-auth' }, noAuth: { type: Boolean, attribute: 'no-auth' },
}; });
} }
connectedCallback() { connectedCallback() {
...@@ -67,7 +70,7 @@ export class MatomoDemo extends ScopedElementsMixin(LitElement) { ...@@ -67,7 +70,7 @@ export class MatomoDemo extends ScopedElementsMixin(LitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -72,7 +72,7 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -72,7 +72,7 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -56,7 +56,7 @@ export class PersonSelectDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -56,7 +56,7 @@ export class PersonSelectDemo extends ScopedElementsMixin(DBPLitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz" url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
</head> </head>
<body> <body>
<dbp-provider id="root" root="1" availability="global" lang="de"> <dbp-provider id="root" root="1" availability="global" lang="de" entry-point-url="http://127.0.0.1:8000">
<dbp-provider-demo id="provider-demo" subscribe="lang:lang"></dbp-provider-demo> <dbp-provider-demo id="provider-demo" subscribe="lang:lang:entry-point-url:entry-point-url"></dbp-provider-demo>
</dbp-provider> </dbp-provider>
<p>version: <span style="color: white; background-color: black;"><%= buildInfo.info %></span></p> <p>version: <span style="color: white; background-color: black;"><%= buildInfo.info %></span></p>
</body> </body>
......
...@@ -77,7 +77,7 @@ class ProviderDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -77,7 +77,7 @@ class ProviderDemo extends ScopedElementsMixin(DBPLitElement) {
<h1 class="title">${i18n.t('demo.provider')}-Demo</h1> <h1 class="title">${i18n.t('demo.provider')}-Demo</h1>
</div> </div>
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" url="https://auth-dev.tugraz.at/auth" realm="tugraz" client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> <dbp-auth-keycloak lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="https://auth-dev.tugraz.at/auth" realm="tugraz" client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
<dbp-language-select></dbp-language-select> <dbp-language-select></dbp-language-select>
</div> </div>
...@@ -124,6 +124,7 @@ class DemoConsumer extends DBPLitElement { ...@@ -124,6 +124,7 @@ class DemoConsumer extends DBPLitElement {
super(); super();
this.lang = 'de'; this.lang = 'de';
this.entryPointUrl = '';
// default values // default values
this.foo = 100; this.foo = 100;
this.bar = 900; this.bar = 900;
...@@ -143,15 +144,15 @@ class DemoConsumer extends DBPLitElement { ...@@ -143,15 +144,15 @@ class DemoConsumer extends DBPLitElement {
} }
static get properties() { static get properties() {
return { return this.getProperties({
...super.properties,
lang: { type: String }, lang: { type: String },
entryPointUrl: { type: String, attribute: 'entry-point-url' },
foo: { type: String }, foo: { type: String },
bar: { type: String }, bar: { type: String },
gong: { type: String }, gong: { type: String },
borderColor: { type: String, attribute: 'border-color' }, borderColor: { type: String, attribute: 'border-color' },
ping: { type: String } ping: { type: String }
}; });
} }
attributeChangedCallback(name, oldValue, newValue) { attributeChangedCallback(name, oldValue, newValue) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment