auth working again
This commit is contained in:
@@ -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<any> {
|
||||
// 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,
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
<mat-grid-tile colspan=4>
|
||||
<mat-list #messageList class="chat-messages">
|
||||
<mat-list-item #messageItem *ngFor="let message of messages; trackBy: getMessageId">
|
||||
<!-- TODO -->
|
||||
<!-- <h3 matLine> {{message.getSender()}} </h3>
|
||||
<h3 matLine> {{message.getSender()}} </h3>
|
||||
<p matLine>
|
||||
{{message.getContent().body}}
|
||||
</p> -->
|
||||
</p>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</mat-grid-tile>
|
||||
|
||||
Reference in New Issue
Block a user