diff --git a/src/app/auth/auth-config.module.ts b/src/app/auth/auth-config.module.ts index 66fbeb0..4340dbe 100644 --- a/src/app/auth/auth-config.module.ts +++ b/src/app/auth/auth-config.module.ts @@ -1,28 +1,8 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http'; -import { APP_INITIALIZER, NgModule } from '@angular/core'; +import { NgModule } from '@angular/core'; import { AuthInterceptor, AuthModule, LogLevel, OidcConfigService } from 'angular-auth-oidc-client'; import { TRAVEL_API_URL, USER_API_URL } from '../app.config'; -// export function configureAuth(oidcConfigService: OidcConfigService): () => Promise { -// return () => -// oidcConfigService.withConfig({ -// stsServer: 'https://okupamicoche-keycloak:8443/auth/realms/okupamicoche', -// redirectUrl: window.location.origin, -// postLogoutRedirectUri: window.location.origin, -// clientId: 'okupamicoche-frontend-angular', -// scope: 'openid profile', -// responseType: 'code', -// silentRenew: true, -// useRefreshToken: true, -// renewTimeBeforeTokenExpiresInSeconds: 30, -// tokenRefreshInSeconds: 20, -// ignoreNonceAfterRefresh: true, // Keycloak's refresh token fails if Nonce is not ignored -// secureRoutes: [TRAVEL_API_URL, USER_API_URL], -// storage: localStorage, -// logLevel: LogLevel.Warn -// }); -// } - @NgModule({ imports: [AuthModule.forRoot({ config: { @@ -34,19 +14,14 @@ import { TRAVEL_API_URL, USER_API_URL } from '../app.config'; responseType: 'code', silentRenew: true, useRefreshToken: true, - logLevel: LogLevel.Debug, + secureRoutes: [TRAVEL_API_URL, USER_API_URL], + logLevel: LogLevel.Warn, ignoreNonceAfterRefresh: true, // Keycloak's refresh token fails if Nonce is not ignored }, })], exports: [AuthModule], providers: [ OidcConfigService, - // { - // provide: APP_INITIALIZER, - // useFactory: configureAuth, - // deps: [OidcConfigService], - // multi: true, - // }, { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 0ccf6fe..610a2ad 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -55,15 +55,6 @@ export class AuthService { console.log('AUTH INITIALIZED isAuthenticated=', auth.isAuthenticated); if (auth.isAuthenticated) { - - - - - console.log('AUTH INITIALIZED result=', auth); - this.apiService.getUser().subscribe(res => console.log(res)); - return AuthState.Logged; - - if (sessionStorage.getItem('chatLoginInProcess') === 'true') { sessionStorage.removeItem('chatLoginInProcess'); diff --git a/src/app/views/chat/chat.component.html b/src/app/views/chat/chat.component.html index aac93b9..1869f41 100644 --- a/src/app/views/chat/chat.component.html +++ b/src/app/views/chat/chat.component.html @@ -19,11 +19,10 @@ - - +