Skip to content

Commit

Permalink
Merge pull request #392 from hsdhott/feature/set_ag_as_default_bugfix
Browse files Browse the repository at this point in the history
Feature/set ag as default bugfix
  • Loading branch information
hsdhott authored Dec 5, 2019
2 parents f585513 + eb79e9c commit 3b96ad5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
12 changes: 8 additions & 4 deletions webapp/src/app/core/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,21 @@ export class AuthService {
}

doLogout() {
this.dataStore.clearAll(); // Calling clear session from data store
localStorage.setItem('logout', 'true');
localStorage.removeItem('logout');

if (this.adAuthentication) {
this.clearSessionStorage();
this.adalService.logout();
} else {
this.onPremAuthentication.logout();
this.clearSessionStorage();
}
}

clearSessionStorage() {
this.dataStore.clearAll(); // Calling clear session from data store
localStorage.setItem('logout', 'true');
localStorage.removeItem('logout');
}

authenticateUserOnPrem(url, method, payload, headers) {

return this.httpService.getHttpResponse(url, method, payload, {}, headers)
Expand Down
3 changes: 3 additions & 0 deletions webapp/src/app/core/services/request-interceptor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export class RequestInterceptorService implements HttpInterceptor {
if (req.url.includes('user/authorize') || req.url.includes('user/login') || req.url.includes('refreshtoken')) {
this.loggerService.log('info', 'Not adding the access token for this api - ' + req.url);
return next.handle(req);
} else if (req.url.includes('user/logout-session')) {
this.loggerService.log('info', 'Do not retry when logging user out - ' + req.url);
return next.handle(this.addToken(req, authService.getAuthToken()));
}
return next.handle(this.addToken(req, authService.getAuthToken())).pipe(
catchError(error => {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export const environment = {
method: 'GET'
},
logout: {
url: '{{baseUrl}}/user/logout-session',
url: '{{baseUrl}}/auth/user/logout-session',
method: 'GET'
},
refresh: {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/environments/environment.stg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export const environment = {
method: 'GET'
},
logout: {
url: '{{baseUrl}}/user/logout-session',
url: '{{baseUrl}}/auth/user/logout-session',
method: 'GET'
},
refresh: {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export const environment = {
method: 'GET'
},
logout: {
url: '{{baseUrl}}/user/logout-session',
url: '{{baseUrl}}/auth/user/logout-session',
method: 'GET'
},
refresh: {
Expand Down

0 comments on commit 3b96ad5

Please sign in to comment.