From 7e90949ff6e218bb25cb0a225ebbe6d1b375930b Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:54:56 +0200 Subject: [PATCH] add revoke requests for future --- .../src/shared/auth/auth-flow.ts | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts b/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts index 8486d344fa..8f9ec99743 100644 --- a/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts +++ b/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts @@ -228,22 +228,33 @@ export class UmbAuthFlow { */ async signOut() { // forget all cached token state - if (!this.#accessTokenResponse) { - return; + await this.#storageBackend.removeItem(TOKEN_RESPONSE_NAME); + + if (this.#accessTokenResponse) { + // TODO: Enable this when the server supports it + // const tokenRevokeRequest = new RevokeTokenRequest({ + // token: this.#accessTokenResponse.accessToken, + // client_id: this.#clientId, + // token_type_hint: 'access_token', + // }); + + // await this.#tokenHandler.performRevokeTokenRequest(this.#configuration, tokenRevokeRequest); + + this.#accessTokenResponse = undefined; } - // TODO: Enable this when the server supports it - // const tokenRevokeRequest = new RevokeTokenRequest({ - // token: this.#accessTokenResponse.accessToken, - // client_id: this.#clientId, - // token_type_hint: 'access_token', - // }); + if (this.#refreshToken) { + // TODO: Enable this when the server supports it + // const tokenRevokeRequest = new RevokeTokenRequest({ + // token: this.#refreshToken, + // client_id: this.#clientId, + // token_type_hint: 'refresh_token', + // }); - // await this.#tokenHandler.performRevokeTokenRequest(this.#configuration, tokenRevokeRequest); + // await this.#tokenHandler.performRevokeTokenRequest(this.#configuration, tokenRevokeRequest); - this.#accessTokenResponse = undefined; - this.#refreshToken = undefined; - await this.#storageBackend.removeItem(TOKEN_RESPONSE_NAME); + this.#refreshToken = undefined; + } } /**