Skip to content

Commit

Permalink
Merge pull request #25312 from mshima/fix-session-cleanup-24608
Browse files Browse the repository at this point in the history
clear session for non authenticated
  • Loading branch information
DanielFran authored Feb 26, 2024
2 parents 828f9a7 + 880d2f6 commit 84e7544
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,18 @@ import { Router } from '@angular/router';

import { LoginService } from 'app/login/login.service';
import { StateStorageService } from 'app/core/auth/state-storage.service';
import { AccountService } from 'app/core/auth/account.service';

@Injectable()
export class AuthExpiredInterceptor implements HttpInterceptor {
private loginService = inject(LoginService);
private stateStorageService = inject(StateStorageService);
private router = inject(Router);
private accountService = inject(AccountService);

intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(
tap({
error: (err: HttpErrorResponse) => {
if (err.status === 401 && err.url && !err.url.includes('api/account') && this.accountService.isAuthenticated()) {
if (err.status === 401 && err.url && !err.url.includes('api/account')) {
<%_ if (authenticationTypeSession) { _%>
if (err.url.includes(this.loginService.logoutUrl())) {
this.loginService.logoutInClient();
Expand Down

0 comments on commit 84e7544

Please sign in to comment.