Compare commits
2 commits
main
...
feat/succe
Author | SHA1 | Date | |
---|---|---|---|
|
fe4116d4c2 | ||
|
56fcb75599 |
1 changed files with 12 additions and 2 deletions
|
@ -9,12 +9,21 @@ import { routes } from './app.routes';
|
||||||
import {
|
import {
|
||||||
KeycloakAngularModule,
|
KeycloakAngularModule,
|
||||||
KeycloakBearerInterceptor,
|
KeycloakBearerInterceptor,
|
||||||
|
KeycloakEventType,
|
||||||
KeycloakService,
|
KeycloakService,
|
||||||
} from 'keycloak-angular';
|
} from 'keycloak-angular';
|
||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||||
|
|
||||||
export const initializeKeycloak = (keycloak: KeycloakService) => async () =>
|
export const initializeKeycloak = (keycloak: KeycloakService) => async () => {
|
||||||
keycloak.init({
|
keycloak.keycloakEvents$.subscribe({
|
||||||
|
next: (e: any) => {
|
||||||
|
if (e.type === KeycloakEventType.OnAuthSuccess) {
|
||||||
|
alert('Login erfolreich');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return await keycloak.init({
|
||||||
config: {
|
config: {
|
||||||
url: 'http://localhost:9090',
|
url: 'http://localhost:9090',
|
||||||
realm: 'LF12',
|
realm: 'LF12',
|
||||||
|
@ -28,6 +37,7 @@ export const initializeKeycloak = (keycloak: KeycloakService) => async () =>
|
||||||
redirectUri: 'http://localhost:4200',
|
redirectUri: 'http://localhost:4200',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function initializeApp(keycloak: KeycloakService): () => Promise<boolean> {
|
function initializeApp(keycloak: KeycloakService): () => Promise<boolean> {
|
||||||
return () => initializeKeycloak(keycloak)();
|
return () => initializeKeycloak(keycloak)();
|
||||||
|
|
Reference in a new issue