WEB-233: Improve the OIDC integration with 2FA (#2602)
This commit is contained in:
@@ -105,15 +105,12 @@ export class AuthenticationService {
|
||||
httpParams = httpParams.set('grant_type', 'password');
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');
|
||||
return this.http
|
||||
.disableApiPrefix()
|
||||
.post(`${environment.oauth.serverUrl}/token`, httpParams.toString(), { headers: headers })
|
||||
.pipe(
|
||||
map((tokenResponse: OAuth2Token) => {
|
||||
this.getUserDetails(tokenResponse);
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
return this.http.post(`${environment.oauth.serverUrl}/token`, httpParams.toString(), { headers: headers }).pipe(
|
||||
map((tokenResponse: OAuth2Token) => {
|
||||
this.getUserDetails(tokenResponse);
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
return this.http
|
||||
.post('/authentication', { username: loginContext.username, password: loginContext.password })
|
||||
@@ -137,7 +134,6 @@ export class AuthenticationService {
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Authorization', 'bearer ' + tokenResponse.access_token);
|
||||
this.http
|
||||
.disableApiPrefix()
|
||||
.get(`${environment.serverUrl}/userdetails`, { headers: headers })
|
||||
.subscribe((credentials: Credentials) => {
|
||||
this.onLoginSuccess(credentials);
|
||||
@@ -174,7 +170,6 @@ export class AuthenticationService {
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');
|
||||
return this.http
|
||||
.disableApiPrefix()
|
||||
.post(`${environment.oauth.serverUrl}/token`, httpParams.toString(), { headers: headers })
|
||||
.subscribe((tokenResponse: OAuth2Token) => {
|
||||
this.storage.setItem(this.oAuthTokenDetailsStorageKey, JSON.stringify(tokenResponse));
|
||||
@@ -241,7 +236,6 @@ export class AuthenticationService {
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');
|
||||
return this.http
|
||||
.disableApiPrefix()
|
||||
.post(`${environment.oauth.serverUrl}/logout`, httpParams.toString(), { headers: headers })
|
||||
.subscribe();
|
||||
}
|
||||
@@ -318,6 +312,14 @@ export class AuthenticationService {
|
||||
}
|
||||
}
|
||||
|
||||
public saveZitadelCredentials(credentials: Credentials): void {
|
||||
this.setCredentials(credentials);
|
||||
}
|
||||
|
||||
public saveZitadeloAuthTokenDetailsStorageKey(tokenResponse: OAuth2Token): void {
|
||||
this.storage.setItem(this.oAuthTokenDetailsStorageKey, JSON.stringify(tokenResponse));
|
||||
}
|
||||
|
||||
/**
|
||||
* Following functions are for two factor authentication and require
|
||||
* first level authorization headers to be setup for the requests.
|
||||
|
||||
Reference in New Issue
Block a user