feat(security): add CORS support and update security config
Some checks failed
CI / Get Changed Files (pull_request) Successful in 9s
CI / eslint (pull_request) Failing after 29s
CI / prettier (pull_request) Failing after 32s
CI / test-build (pull_request) Failing after 58s
CI / Checkstyle Main (pull_request) Successful in 1m24s

This commit is contained in:
Constantin Simonis 2025-03-26 13:27:42 +01:00
commit 3da534f3ae
No known key found for this signature in database
GPG key ID: 3878FF77C24AF4D2
11 changed files with 53 additions and 49 deletions

View file

@ -1,6 +1,6 @@
import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { catchError, EMPTY, Observable, of, switchMap } from 'rxjs';
import { catchError, EMPTY, Observable } from 'rxjs';
import { User } from '../model/User';
@Injectable({
@ -9,10 +9,6 @@ import { User } from '../model/User';
export class UserService {
private http: HttpClient = inject(HttpClient);
public getUser(id: string): Observable<User | null> {
return this.http.get<User | null>(`/backend/user/${id}`).pipe(catchError(() => EMPTY));
}
public getCurrentUser(): Observable<User | null> {
return this.http.get<User | null>('/backend/user').pipe(catchError(() => EMPTY));
}
@ -27,10 +23,6 @@ export class UserService {
public getOrCreateUser(profile: any): Observable<User> {
const id = profile.info.sub;
const username = profile.info.preferred_username;
try {
return this.getUser(id) as Observable<User>;
} catch (error) {
return this.createUser(id, username);
}
return this.createUser(id, username);
}
}