Skip to content
Snippets Groups Projects
Commit dc2cf7b0 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4321 remove unused proxy.json; use existing enum

parent 2e96c730
No related branches found
No related tags found
No related merge requests found
{
"/api": {
"target": {
"host": "http://localhost:8080",
"protocol": "http:"
},
"secure": false,
"logLevel": "debug"
}
}
export const TOKEN_EXPIRED_TYPE: number = 6;
import { Mock, mock, useFromMock } from '@alfa-client/test-utils'; import { Mock, mock, useFromMock } from '@alfa-client/test-utils';
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
import { KeycloakService, KeycloakEvent } from 'keycloak-angular'; import { KeycloakService, KeycloakEvent, KeycloakEventType } from 'keycloak-angular';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { TOKEN_EXPIRED_TYPE } from './auth.const';
import { KeycloakProfile } from 'keycloak-js'; import { KeycloakProfile } from 'keycloak-js';
import { StateResource, createStateResource } from '@alfa-client/tech-shared'; import { StateResource, createStateResource } from '@alfa-client/tech-shared';
import { UserProfileResource } from '@alfa-client/user-profile-shared'; import { UserProfileResource } from '@alfa-client/user-profile-shared';
...@@ -32,7 +31,7 @@ describe('AuthService', () => { ...@@ -32,7 +31,7 @@ describe('AuthService', () => {
describe('handleEvent', () => { describe('handleEvent', () => {
describe('on token expired event', () => { describe('on token expired event', () => {
const tokenExpiredEvent: KeycloakEvent = { type: TOKEN_EXPIRED_TYPE }; const tokenExpiredEvent: KeycloakEvent = { type: KeycloakEventType.OnTokenExpired };
it('should updateToken', () => { it('should updateToken', () => {
service.handleEvent(tokenExpiredEvent); service.handleEvent(tokenExpiredEvent);
......
...@@ -4,10 +4,9 @@ import { ...@@ -4,10 +4,9 @@ import {
createStateResource, createStateResource,
} from '@alfa-client/tech-shared'; } from '@alfa-client/tech-shared';
import { Injectable, WritableSignal, signal } from '@angular/core'; import { Injectable, WritableSignal, signal } from '@angular/core';
import { KeycloakEvent, KeycloakService } from 'keycloak-angular'; import { KeycloakEvent, KeycloakEventType, KeycloakService } from 'keycloak-angular';
import { KeycloakProfile } from 'keycloak-js'; import { KeycloakProfile } from 'keycloak-js';
import { UserProfileResource } from 'libs/user-profile-shared/src/lib/user-profile.model'; import { UserProfileResource } from 'libs/user-profile-shared/src/lib/user-profile.model';
import { TOKEN_EXPIRED_TYPE } from './auth.const';
import { getUserNameInitials } from 'libs/user-profile-shared/src/lib/user-profile.util'; import { getUserNameInitials } from 'libs/user-profile-shared/src/lib/user-profile.util';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
...@@ -27,7 +26,7 @@ export class AuthService { ...@@ -27,7 +26,7 @@ export class AuthService {
} }
async handleEvent(event: KeycloakEvent): Promise<void> { async handleEvent(event: KeycloakEvent): Promise<void> {
if (event.type === TOKEN_EXPIRED_TYPE) { if (event.type === KeycloakEventType.OnTokenExpired) {
await this.keycloak await this.keycloak
.updateToken(10) .updateToken(10)
.then((refreshed) => this.handleTokenExpiredEvent(refreshed)); .then((refreshed) => this.handleTokenExpiredEvent(refreshed));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment