feat(security): add CORS support and update security config
Some checks failed
Some checks failed
This commit is contained in:
parent
242b72ca45
commit
3da534f3ae
11 changed files with 53 additions and 49 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue