mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4665] [ADF] - Application is refreshed when you have two instances of application opened (#4849)
* refactoring getValueFromToken and fix user token refresh * refactoring getValueFromToken and fix user token refresh * refactoring getValueFromToken and fix user token refres * fix unit test
This commit is contained in:
@@ -21,6 +21,7 @@ import { AuthenticationService } from './authentication.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { AuthGuardBase } from './auth-guard-base';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -29,7 +30,8 @@ export class AuthGuard extends AuthGuardBase {
|
||||
|
||||
ticketChangeBind: any;
|
||||
|
||||
constructor(authenticationService: AuthenticationService,
|
||||
constructor(private jwtHelperService: JwtHelperService,
|
||||
authenticationService: AuthenticationService,
|
||||
router: Router,
|
||||
appConfigService: AppConfigService) {
|
||||
super(authenticationService, router, appConfigService);
|
||||
@@ -47,7 +49,9 @@ export class AuthGuard extends AuthGuardBase {
|
||||
this.ticketChangeRedirect(event, 'BPM');
|
||||
}
|
||||
|
||||
if (event.key === 'id_token' && event.newValue !== event.oldValue) {
|
||||
if (event.key === JwtHelperService.USER_ACCESS_TOKEN &&
|
||||
this.jwtHelperService.getValueFromToken(event.newValue, JwtHelperService.USER_PREFERRED_USERNAME) !==
|
||||
this.jwtHelperService.getValueFromToken(event.oldValue, JwtHelperService.USER_PREFERRED_USERNAME)) {
|
||||
this.ticketChangeRedirect(event, 'ALL');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user