new initialization process, keycloak update 24.0.4
This commit is contained in:
15
bizmatch/src/app/resolvers/auth.resolver.ts
Normal file
15
bizmatch/src/app/resolvers/auth.resolver.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { KeycloakService } from '../services/keycloak.service';
|
||||
|
||||
export const authResolver: ResolveFn<boolean> = async (route, state) => {
|
||||
const keycloakService: KeycloakService = inject(KeycloakService);
|
||||
|
||||
if (!keycloakService.isLoggedIn()) {
|
||||
await keycloakService.login({
|
||||
redirectUri: window.location.href,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
Reference in New Issue
Block a user