X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fservices%2FAuthInterceptorService.ts;h=4a66482261af3d020c6343b645296e15a97d1f45;hb=refs%2Ftags%2Fv8.0.2;hp=ede10a8b2ab4d010d87b8f2a2d4bdb90391261ab;hpb=3b4814aa2d3dec621dadb52f058ba95a3dc3a86a;p=osm%2FNG-UI.git diff --git a/src/services/AuthInterceptorService.ts b/src/services/AuthInterceptorService.ts index ede10a8..4a66482 100644 --- a/src/services/AuthInterceptorService.ts +++ b/src/services/AuthInterceptorService.ts @@ -103,18 +103,23 @@ export class AuthInterceptorService implements HttpInterceptor { public errorRes(err: HttpErrorResponse, req: HttpRequest<{}>, next: HttpHandler): Observable<{}> { if (err instanceof HttpErrorResponse) { switch (err.status) { - case HttpStatus.UNAUTHORIZED || HttpStatus.FORBIDDEN: + case HttpStatus.UNAUTHORIZED: + case HttpStatus.FORBIDDEN: this.handleError(err); break; + case HttpStatus.GATEWAY_TIMEOUT: + case HttpStatus.BAD_GATEWAY: + this.notifierService.hideAll(); + this.authService.logoutResponse(); + break; default: return throwError(err); } } else { return throwError(err); } } - /** Method to handle 401 & 403 error */ + /** Method to handle 401, 403 & 502 error */ private handleError(err: HttpErrorResponse): void { - if (err.error.detail === 'Expired Token or Authorization HTTP header' || - err.error.detail === 'Invalid Token or Authorization HTTP header') { + if (err.error.detail !== 'Access denied: lack of permissions.') { this.notifierService.hideAll(); this.authService.logoutResponse(); if (this.authService.handle401) {