From 5be222cea8452b9078bbbfc53ec86b3f472bad26 Mon Sep 17 00:00:00 2001 From: Helmut Hutzler <helmut.hutzler@th-nuernberg.de> Date: Tue, 15 Nov 2022 16:19:39 +0100 Subject: [PATCH] Testing apiurl for production --- src/app/account.service.ts | 13 +++++++++++-- src/app/auth-config.module.ts | 4 ++-- src/environments/environment.prod.ts | 2 +- src/environments/environment.ts | 7 ++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/app/account.service.ts b/src/app/account.service.ts index 140d651..b36989a 100644 --- a/src/app/account.service.ts +++ b/src/app/account.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import {Injectable, OnDestroy, OnInit} from '@angular/core'; import {MessageService} from "./message.service"; import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http"; import {map, Observable, of, tap, throwError} from 'rxjs'; @@ -9,10 +9,19 @@ import { environment } from '../environments/environment'; @Injectable({ providedIn: 'root' }) -export class AccountService { +export class AccountService implements OnInit { constructor(public messageService: MessageService, private http: HttpClient) { } + + ngOnInit() { + this.logHeader = "[AccountService:ngOnInit()] "; + this.messageService.add(this.logHeader + "\n keycloakURL: " + environment.keycloakURL + + "\n apiURL : " + environment.apiURL + + "\n secureRoute: " + environment.secureRoute + "\n"); + + // this.messageService.add(this.logHeader + 'Initial call to isAuthenticated: ' + this.isAuthenticated); + } private logHeader = '' private apiURL = environment.apiURL; 'http://localhost:8080/api'; diff --git a/src/app/auth-config.module.ts b/src/app/auth-config.module.ts index 2380ed6..37c45b1 100644 --- a/src/app/auth-config.module.ts +++ b/src/app/auth-config.module.ts @@ -24,8 +24,8 @@ import { environment } from '../environments/environment'; renewTimeBeforeTokenExpiresInSeconds: 10, // startCheckSession: true, ignoreNonceAfterRefresh: true, - // routes that get added a bearer token by HTTP_INTERCEPTORS provided by angular-auth-oidc-client' - secureRoutes: ['http://localhost:8080'] + // routes that get added a bearer token by HTTP_INTERCEPTORS provided by angular-auth-oidc-client lib' + secureRoutes: [ environment.secureRoute ] }, }), ], diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index e994229..e1f3b1b 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -2,6 +2,6 @@ export const environment = { production: true, //keycloakURL: 'https://kube-master-h1.informatik.fh-nuernberg.de:/auth/', keycloakURL: '/auth/', - apiURL: '/api' + apiURL: 'https://kube-master-h1.informatik.fh-nuernberg.de:/api' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 40e1559..071aea2 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,10 +5,11 @@ export const environment = { production: false, - // keycloakURL: 'http://localhost:8280/auth/' + keycloakURL: 'http://localhost:8280/auth/', // keycloakURL: '/auth/', - keycloakURL: 'https://kube-master-h1.informatik.fh-nuernberg.de:/auth/', - apiURL: 'http://localhost:8080/api' + // keycloakURL: 'https://kube-master-h1.informatik.fh-nuernberg.de:/auth/', + apiURL: 'http://localhostxx:8080/api', + secureRoute: 'http://localhost:8080/' }; /* -- GitLab