Ejemplo n.º 1
0
 this.eventManager.subscribe('authenticationSuccess', (message) => {
     this.principal.identity().then((account) => {
         this.account = account;
         this.refreshReloadSubscription = this.refreshService.refreshReload$.subscribe((empty) => this.populateDashboard());
         this.populateDashboard();
     });
 });
Ejemplo n.º 2
0
    ngOnInit() {
        this.principal.identity().then((account) => {
            this.account = account;
            if (!account || !this.isAuthenticated()) {
                this.login();
            } else {
                this.refreshReloadSubscription = this.refreshService.refreshReload$.subscribe((empty) => this.populateDashboard());
                this.populateDashboard();
            }
        });

        this.registerAuthenticationSuccess();
    }
Ejemplo n.º 3
0
            principal.identity().then((account) => {
                if (account && principal.hasAnyAuthorityDirect(authorities)) {
                    return true;
                }

                this.stateStorageService.storeUrl(url);
                this.router.navigate(['accessdenied']).then(() => {
                    // only show the login dialog, if the user hasn't logged in yet
                    if (!account) {
                        this.loginModalService.open();
                    }
                });
                return false;
            })
Ejemplo n.º 4
0
    checkLogin(authorities: string[], url: string): Promise<boolean> {
        const principal = this.principal;
        return Promise.resolve(
            principal.identity().then((account) => {
                if (account && principal.hasAnyAuthorityDirect(authorities)) {
                    return true;
                }

                this.stateStorageService.storeUrl(url);
                this.router.navigate(['accessdenied']).then(() => {
                    // only show the login dialog, if the user hasn't logged in yet
                    if (!account) {
                        this.loginModalService.open();
                    }
                });
                return false;
            })
        );
    }
Ejemplo n.º 5
0
 getImageUrl() {
     return this.isAuthenticated() ? this.principal.getImageUrl() : null;
 }
Ejemplo n.º 6
0
 isAuthenticated() {
     return this.principal.isAuthenticated();
 }
Ejemplo n.º 7
0
 this.eventManager.subscribe('authenticationSuccess', (message) => {
     this.principal.identity().then((account) => {
         this.account = account;
         this.populateDashboard();
     });
 });