本文整理汇总了TypeScript中angular-auth-oidc-client.OidcSecurityService.getIsAuthorized方法的典型用法代码示例。如果您正苦于以下问题:TypeScript OidcSecurityService.getIsAuthorized方法的具体用法?TypeScript OidcSecurityService.getIsAuthorized怎么用?TypeScript OidcSecurityService.getIsAuthorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular-auth-oidc-client.OidcSecurityService
的用法示例。
在下文中一共展示了OidcSecurityService.getIsAuthorized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onOidcModuleSetup
private onOidcModuleSetup() {
if (window.location.hash) {
this.oidcSecurityService.authorizedCallback();
} else {
if ('/autologin' !== window.location.pathname) {
this.write('redirect', window.location.pathname);
}
this.oidcSecurityService
.getIsAuthorized()
.subscribe((authorized: boolean) => {
if (!authorized) {
this.router.navigate(['/autologin']);
} else {
}
});
}
}
示例2: canActivate
canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
console.log('auth guard: can activate ...');
return this.oidcSecurityService.getIsAuthorized()
.map((isAuthorized: boolean) => {
if ( isAuthorized ) {
console.log(state.url);
return true;
}
this.redirectUrl = state.url;
console.log('auth guard: redirect to login:');
// this.oidcSecurityService.authorize();
this.router.navigate(['autologin'], {queryParams: { returnUrl: state.url }});
console.log(state.url);
return false;
});
// return this.getAuthorized(state.url);
}
示例3: onOidcModuleSetup
private onOidcModuleSetup() {
if (window.location.hash) {
this.oidcSecurityService.authorizedCallback();
} else {
if ('/autologin' !== window.location.pathname) {
this.write('redirect', window.location.pathname);
}
this.oidcSecurityService
.getIsAuthorized()
.subscribe((authorized: boolean) => {
if (!authorized) {
this.router.navigate(['/autologin']);
} else {
if (!this.read('from_silent_renew')) {
this.store.dispatch(new fromStore.LoadPanels());
}
}
});
}
}