Skip to content

Commit

Permalink
fix: update keycloak http client
Browse files Browse the repository at this point in the history
  • Loading branch information
renanfranca committed Sep 20, 2024
1 parent c5bd361 commit e641676
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Binary file modified .aider.tags.cache.v3/cache.db-shm
Binary file not shown.
Binary file modified .aider.tags.cache.v3/cache.db-wal
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AuthenticatedUser } from '@/auth/domain/AuthenticatedUser';
import { KeycloakHttp } from './KeycloakHttp';

export class KeycloakAuthRepository implements AuthRepository {
constructor(private keycloakHttp: KeycloakHttp) {}
constructor(private readonly keycloakHttp: KeycloakHttp) {}

async currentUser(): Promise<AuthenticatedUser> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class KeycloakHttp {
if (this.keycloak.authenticated) {
return {
isAuthenticated: true,
username: this.keycloak.tokenParsed?.preferred_username || '',
token: this.keycloak.token || '',
username: this.keycloak.tokenParsed?.preferred_username ?? '',
token: this.keycloak.token ?? '',
};
} else {
return { isAuthenticated: false, username: '', token: '' };
Expand All @@ -44,6 +44,6 @@ export class KeycloakHttp {
async refreshToken(): Promise<string> {
await this.ensureInitialized();
await this.keycloak.updateToken(5);
return this.keycloak.token || '';
return this.keycloak.token ?? '';
}
}

0 comments on commit e641676

Please sign in to comment.