Auth: Fix redirection in case of ERR_TOKEN_REVOKED (#94137)
Fix redirection in case of token revoked error
This commit is contained in:
@@ -382,6 +382,7 @@ export class BackendSrv implements BackendService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
this.dependencies.contextSrv.setRedirectToUrl();
|
||||||
return throwError(() => error);
|
return throwError(() => error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,16 +120,20 @@ export class ContextSrv {
|
|||||||
* Indicate the user has been logged out
|
* Indicate the user has been logged out
|
||||||
*/
|
*/
|
||||||
setLoggedOut() {
|
setLoggedOut() {
|
||||||
|
this.setRedirectToUrl();
|
||||||
|
this.cancelTokenRotationJob();
|
||||||
|
this.user.isSignedIn = false;
|
||||||
|
this.isSignedIn = false;
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
setRedirectToUrl() {
|
||||||
if (config.featureToggles.useSessionStorageForRedirection) {
|
if (config.featureToggles.useSessionStorageForRedirection) {
|
||||||
window.sessionStorage.setItem(
|
window.sessionStorage.setItem(
|
||||||
RedirectToUrlKey,
|
RedirectToUrlKey,
|
||||||
encodeURIComponent(window.location.href.substring(window.location.origin.length))
|
encodeURIComponent(window.location.href.substring(window.location.origin.length))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.cancelTokenRotationJob();
|
|
||||||
this.user.isSignedIn = false;
|
|
||||||
this.isSignedIn = false;
|
|
||||||
window.location.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRole(role: string) {
|
hasRole(role: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user