Commit 092d9dbc authored by Matthieu Fesselier's avatar Matthieu Fesselier

Merge branch 'logout-after-session-expiration' into 'master'

update: logout after session expiration

Closes #25

See merge request !15
parents fef0f6b4 f75f4a03
Pipeline #5259 passed with stage
in 53 seconds
......@@ -31,6 +31,12 @@ class SIBAuth extends HTMLElement {
if (await this.getUserWebId()) {
this.dispatchUserInfo();
}
const session = await new Promise(a => auth.trackSession(a));
if (!session) return;
const timeout = session.idClaims.exp * 1000 - Date.now();
setTimeout(() => {
this.logout();
}, timeout);
}
/** @function
......@@ -219,7 +225,7 @@ class SIBAuth extends HTMLElement {
* @name login
* Try to login, if favorite provider is set, trigger login, if not, select provider
*/
async login() {
login() {
const favoriteProvider = this.getFavoriteProvider();
if (favoriteProvider) {
this.callProvider(favoriteProvider, 'login', this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment