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

auth-keycloak: remove the load-person attribute

We now enable it by default for everyone. The plan is to load the API
user instead and not the person as a next step. This api should work
even for users that don't have a person associated.
parent d047df42
No related branches found
No related tags found
No related merge requests found
Pipeline #56834 passed
Showing
with 15 additions and 21 deletions
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<body> <body>
<dbp-app-shell auth requested-login-status keycloak-config='{"url": "https://auth-dev.tugraz.at/auth", "realm": "tugraz-vpu", "clientId": "auth-dev-mw-frontend-local", "silentCheckSsoRedirectUri": "/silent-check-sso.html"}' src="/example.topic.metadata.json"></dbp-app-shell> <dbp-app-shell auth requested-login-status entry-point-url="http://127.0.0.1:8000" keycloak-config='{"url": "https://auth-dev.tugraz.at/auth", "realm": "tugraz-vpu", "clientId": "auth-dev-mw-frontend-local", "silentCheckSsoRedirectUri": "/silent-check-sso.html"}' src="/example.topic.metadata.json"></dbp-app-shell>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -878,7 +878,7 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) { ...@@ -878,7 +878,7 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) {
return html` return html`
<slot class="${slotClassMap}"></slot> <slot class="${slotClassMap}"></slot>
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" load-person ?force-login="${kc.forceLogin}" ?try-login="${!kc.forceLogin}"></dbp-auth-keycloak> <dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" ?force-login="${kc.forceLogin}" ?try-login="${!kc.forceLogin}"></dbp-auth-keycloak>
<dbp-matomo subscribe="auth,analytics-event" endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}" git-info="${this.gitInfo}"></dbp-matomo> <dbp-matomo subscribe="auth,analytics-event" endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}" git-info="${this.gitInfo}"></dbp-matomo>
<div class="${mainClassMap}"> <div class="${mainClassMap}">
<div id="main"> <div id="main">
......
...@@ -30,9 +30,6 @@ for more explanation. ...@@ -30,9 +30,6 @@ for more explanation.
- `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 `<dbp-auth-keycloak lang="de" </dbp-auth-keycloak>` - example `<dbp-auth-keycloak lang="de" </dbp-auth-keycloak>`
- `load-person` (optional, default: off): if enabled the logged in user will also be loaded as `Person`
in the `auth.person` attribute (see below)
- example `<dbp-auth-keycloak load-person></dbp-auth-keycloak>`
- `force-login` (optional, default: off): if enabled a login will be forced, there never will be a login button - `force-login` (optional, default: off): if enabled a login will be forced, there never will be a login button
- example `<dbp-auth-keycloak force-login></dbp-auth-keycloak>` - example `<dbp-auth-keycloak force-login></dbp-auth-keycloak>`
- `try-login` (optional, default: off): if enabled the a login will happen if the user is already logged in - `try-login` (optional, default: off): if enabled the a login will happen if the user is already logged in
...@@ -59,7 +56,7 @@ The component emits a `dbp-set-property` event for the attribute `auth`: ...@@ -59,7 +56,7 @@ The component emits a `dbp-set-property` event for the attribute `auth`:
- `auth.token`: Keycloak token to send with your requests - `auth.token`: Keycloak token to send with your requests
- `auth.user-full-name`: Full name of the user - `auth.user-full-name`: Full name of the user
- `auth.person-id`: Person identifier of the user - `auth.person-id`: Person identifier of the user
- `auth.person`: Person json object of the user (optional, enable by setting the `load-person` attribute) - `auth.person`: Person json object of the user
## Login Button ## Login Button
......
...@@ -15,13 +15,12 @@ import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; ...@@ -15,13 +15,12 @@ import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
* auth.token: Keycloak token to send with your requests * auth.token: Keycloak token to send with your requests
* auth.user-full-name: Full name of the user * auth.user-full-name: Full name of the user
* auth.person-id: Person identifier of the user * auth.person-id: Person identifier of the user
* auth.person: Person json object of the user (optional, enable by setting the `load-person` attribute) * auth.person: Person json object of the user
*/ */
export class AuthKeycloak extends AdapterLitElement { export class AuthKeycloak extends AdapterLitElement {
constructor() { constructor() {
super(); super();
this.forceLogin = false; this.forceLogin = false;
this.loadPerson = false;
this.token = ""; this.token = "";
this.subject = ""; this.subject = "";
this.name = ""; this.name = "";
...@@ -117,8 +116,7 @@ export class AuthKeycloak extends AdapterLitElement { ...@@ -117,8 +116,7 @@ export class AuthKeycloak extends AdapterLitElement {
} }
const that = this; const that = this;
if (newPerson) {
if (newPerson && this.loadPerson) {
JSONLD.getInstance(this.entryPointUrl).then((jsonld) => { JSONLD.getInstance(this.entryPointUrl).then((jsonld) => {
try { try {
// find the correct api url for the current person // find the correct api url for the current person
...@@ -180,7 +178,6 @@ export class AuthKeycloak extends AdapterLitElement { ...@@ -180,7 +178,6 @@ export class AuthKeycloak extends AdapterLitElement {
lang: { type: String }, lang: { type: String },
forceLogin: { type: Boolean, attribute: 'force-login' }, forceLogin: { type: Boolean, attribute: 'force-login' },
tryLogin: { type: Boolean, attribute: 'try-login' }, tryLogin: { type: Boolean, attribute: 'try-login' },
loadPerson: { type: Boolean, attribute: 'load-person' },
entryPointUrl: { type: String, attribute: 'entry-point-url' }, entryPointUrl: { type: String, attribute: 'entry-point-url' },
name: { type: String, attribute: false }, name: { type: String, attribute: false },
token: { type: String, attribute: false }, token: { type: String, attribute: false },
......
...@@ -84,7 +84,7 @@ export class DbpAuthDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -84,7 +84,7 @@ export class DbpAuthDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -55,7 +55,7 @@ export class CheckInPlaceSelectDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -55,7 +55,7 @@ export class CheckInPlaceSelectDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -89,7 +89,7 @@ export class DbpCommonDemo extends ScopedElementsMixin(LitElement) { ...@@ -89,7 +89,7 @@ export class DbpCommonDemo extends ScopedElementsMixin(LitElement) {
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`` : html` return this.noAuth ? html`` : html`
<div class="container"> <div class="container">
<dbp-auth lang="${this.lang}" load-person></dbp-auth> <dbp-auth lang="${this.lang}"></dbp-auth>
</div> </div>
`; `;
} }
......
...@@ -144,7 +144,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -144,7 +144,7 @@ export class DataTableViewDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -72,7 +72,7 @@ export class KnowledgeBaseWebPageElementViewDemo extends ScopedElementsMixin(DBP ...@@ -72,7 +72,7 @@ export class KnowledgeBaseWebPageElementViewDemo extends ScopedElementsMixin(DBP
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -76,7 +76,7 @@ export class MatomoDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -76,7 +76,7 @@ export class MatomoDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -57,7 +57,7 @@ export class OrganizationSelectDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -57,7 +57,7 @@ export class OrganizationSelectDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -93,7 +93,7 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -93,7 +93,7 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -57,7 +57,7 @@ export class PersonSelectDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -57,7 +57,7 @@ export class PersonSelectDemo extends ScopedElementsMixin(DBPLitElement) {
<div class="container"> <div class="container">
<dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html" <dbp-auth-keycloak subscribe="requested-login-status" 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-vpu" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
</div> </div>
`; `;
......
...@@ -75,7 +75,7 @@ class ProviderDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -75,7 +75,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 subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu" client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> <dbp-auth-keycloak subscribe="requested-login-status" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" url="https://auth-dev.tugraz.at/auth" realm="tugraz-vpu" client-id="auth-dev-mw-frontend-local" try-login></dbp-auth-keycloak>
<dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button> <dbp-login-button subscribe="auth" lang="${this.lang}"></dbp-login-button>
<dbp-language-select></dbp-language-select> <dbp-language-select></dbp-language-select>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment