diff --git a/packages/auth/src/auth-keycloak.js b/packages/auth/src/auth-keycloak.js index b59dd2cfc759f4d5abf20ece07779e74739dabaa..d7d2c73878ac7c6f6d705b7eca3c51734c82f17d 100644 --- a/packages/auth/src/auth-keycloak.js +++ b/packages/auth/src/auth-keycloak.js @@ -117,6 +117,7 @@ export class AuthKeycloak extends AdapterLitElement { .then((person) => { that.person = person; window.DBPPerson = person; + this.sendSetPropertyEvents(); this._setLoginStatus(this._loginStatus, true); }); }, {}, that.lang); @@ -124,11 +125,19 @@ export class AuthKeycloak extends AdapterLitElement { } sendSetPropertyEvents() { - this.sendSetPropertyEvent('auth-subject', this.subject); - this.sendSetPropertyEvent('auth-token', this.token); - this.sendSetPropertyEvent('user-full-name', this.name); - this.sendSetPropertyEvent('person-id', this.personId); - this.sendSetPropertyEvent('person', this.person); + this.sendSetPropertyEvent('auth', { + 'subject': this.subject, + 'token': this.token, + 'user-full-name': this.name, + 'person-id': this.personId, + 'person': this.person, + }); + + // this.sendSetPropertyEvent('auth-subject', this.subject); + // this.sendSetPropertyEvent('auth-token', this.token); + // this.sendSetPropertyEvent('user-full-name', this.name); + // this.sendSetPropertyEvent('person-id', this.personId); + // this.sendSetPropertyEvent('person', this.person); } _setLoginStatus(status, force) { diff --git a/packages/person-select/src/person-select.js b/packages/person-select/src/person-select.js index b662067aeb4d7b41a211017a843f5d0eaa99f43d..8811f957fb9e02c3276b0e07b1c4d0258c8ea057 100644 --- a/packages/person-select/src/person-select.js +++ b/packages/person-select/src/person-select.js @@ -27,6 +27,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) { constructor() { super(); + this.auth = {}; this.lang = 'de'; this.entryPointUrl = ''; this.jsonld = null; @@ -65,6 +66,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) { showReloadButton: { type: Boolean, attribute: 'show-reload-button' }, reloadButtonTitle: { type: String, attribute: 'reload-button-title' }, showBirthDate: { type: Boolean, attribute: 'show-birth-date' }, + auth: { type: Object }, }; } @@ -221,7 +223,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) { fetch(apiUrl, { headers: { 'Content-Type': 'application/ld+json', - 'Authorization': 'Bearer ' + window.DBPAuthToken, + 'Authorization': 'Bearer ' + this.auth.token || window.DBPAuthToken, }, }) .then(result => {