mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-4637] logout cross tabs event (#4823)
* logout cross tabs event * fix remove listner * fix remove listner * Update auth-guard.service.ts
This commit is contained in:
parent
105a1a2b28
commit
cb37254cae
@ -26,7 +26,7 @@ import { StorageService } from './storage.service';
|
||||
export class AuthGuardSsoRoleService implements CanActivate {
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
let hasRole = false;
|
||||
let hasRole;
|
||||
let hasRealmRole = false;
|
||||
let hasClientRole = true;
|
||||
|
||||
|
@ -66,7 +66,7 @@ describe('AuthGuardService', () => {
|
||||
spyOn(authService, 'isBpmLoggedIn').and.returnValue(true);
|
||||
appConfigService.config.auth.withCredentials = true;
|
||||
|
||||
const route: RouterStateSnapshot = <RouterStateSnapshot> {url : 'some-url'};
|
||||
const route: RouterStateSnapshot = <RouterStateSnapshot> { url: 'some-url' };
|
||||
|
||||
expect(authGuard.canActivate(null, route)).toBeTruthy();
|
||||
}));
|
||||
|
@ -26,10 +26,40 @@ import { AuthGuardBase } from './auth-guard-base';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthGuard extends AuthGuardBase {
|
||||
|
||||
ticketChangeBind: any;
|
||||
|
||||
constructor(authenticationService: AuthenticationService,
|
||||
router: Router,
|
||||
appConfigService: AppConfigService) {
|
||||
super(authenticationService, router, appConfigService);
|
||||
this.ticketChangeBind = this.ticketChange.bind(this);
|
||||
|
||||
window.addEventListener('storage', this.ticketChangeBind);
|
||||
}
|
||||
|
||||
ticketChange(event: StorageEvent) {
|
||||
if (event.key === 'ticket-ECM' && event.newValue !== event.oldValue) {
|
||||
this.ticketChangeRedirect(event, 'ECM');
|
||||
}
|
||||
|
||||
if (event.key === 'ticket-BPM' && event.newValue !== event.oldValue) {
|
||||
this.ticketChangeRedirect(event, 'BPM');
|
||||
}
|
||||
|
||||
if (event.key === 'access_token' && event.newValue !== event.oldValue) {
|
||||
this.ticketChangeRedirect(event, 'ALL');
|
||||
}
|
||||
}
|
||||
|
||||
private ticketChangeRedirect(event: StorageEvent, provider: string) {
|
||||
if (!event.newValue) {
|
||||
this.redirectToUrl(provider, this.router.url);
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
window.removeEventListener('storage', this.ticketChangeBind);
|
||||
}
|
||||
|
||||
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
|
@ -25,11 +25,11 @@ while [[ $1 == -* ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
COMPONENTS_ROOT="$DIR/../lib"
|
||||
COMPONENTS_ROOT="$DIR/../../lib"
|
||||
|
||||
# Find all directories in $COMPONENTS_ROOT called i18n and add the demo-shell manually
|
||||
COMPONENTS=(`find $COMPONENTS_ROOT -type d -name i18n -not \( -name '*.*' -o -path '**/node_modules*' -o -path '**/bundles*' \)`)
|
||||
COMPONENTS+=("$DIR/../demo-shell/resources/i18n")
|
||||
COMPONENTS+=("$DIR/../../demo-shell/resources/i18n")
|
||||
|
||||
# Loop the individual components
|
||||
for COMPONENT_DIR in "${COMPONENTS[@]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user