Pull request #20: login url test
Merge in SL/common-ui from login-link-test to master * commit 'a147ba5b8d1d0613c5b667275bd5e30f13115eb4': login url test
This commit is contained in:
commit
b42baa37fc
@ -56,7 +56,11 @@ export class ServerErrorInterceptor implements HttpInterceptor {
|
||||
catchError((error: HttpErrorResponse) => {
|
||||
// token expired
|
||||
if (error.status === HttpStatusCode.Unauthorized) {
|
||||
this._keycloakService.logout();
|
||||
const url = this._keycloakService.getKeycloakInstance().createLoginUrl({
|
||||
loginHint: 'login',
|
||||
redirectUri: window.location.href,
|
||||
});
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
// server error
|
||||
|
||||
@ -15,6 +15,9 @@ export class ErrorMessageService {
|
||||
}
|
||||
|
||||
private _parseErrorResponse(err: HttpErrorResponse): string {
|
||||
return (err?.error?.message?.match('"message":"(.*?)\\"')?.[0].replace(/"message":"|"/gm, '') as string) || (err?.error?.message as string);
|
||||
return (
|
||||
(err?.error?.message?.match('"message":"(.*?)\\"')?.[0].replace(/"message":"|"/gm, '') as string) ||
|
||||
(err?.error?.message as string)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,11 +41,10 @@ function getKeycloakOptions(baseUrl: string, configService: IqserConfigService):
|
||||
|
||||
function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) {
|
||||
keyCloakService.getKeycloakInstance().onAuthRefreshError = () => {
|
||||
const url = keyCloakService.getKeycloakInstance().createLoginUrl({
|
||||
loginHint:'login',
|
||||
const url = keyCloakService.getKeycloakInstance().createLoginUrl({
|
||||
loginHint: 'login',
|
||||
redirectUri: window.location.href,
|
||||
});
|
||||
console.log('creating login url',url)
|
||||
window.location.href = url;
|
||||
};
|
||||
}
|
||||
|
||||
@ -51,7 +51,12 @@ export abstract class IqserUserService<
|
||||
|
||||
async logout() {
|
||||
await this._cacheApiService.wipeCaches();
|
||||
await this._keycloakService.logout(window.location.origin + this._baseHref);
|
||||
await this._keycloakService.logout();
|
||||
const url = this._keycloakService.getKeycloakInstance().createLoginUrl({
|
||||
loginHint: 'login',
|
||||
redirectUri: window.location.origin + this._baseHref,
|
||||
});
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user