【发布时间】:2017-06-28 08:24:13
【问题描述】:
我有一个 Angular 2 应用程序,我正在使用 adal 库对 adfs 进行身份验证。这实际上是开箱即用的位置策略,没有散列,这很棒。 ADFS 重定向发送此参数,adal-service 可以使用它。
#id_token=<sometokenvalue>
但由于某些原因,我需要使用哈希定位策略。在这种情况下,正确的 url 会在浏览器的地址栏中弹出一秒钟,然后 angular 路由器正在发挥作用,我的令牌丢失了,url 看起来像这样:
http://localhost:4200/#/id_token
我的 SecretService 看起来像这样:
public get adalConfig(): any {
return {
tenant: 'adfs',
instance: LoginConfig.getInstance(),
clientId: LoginConfig.getClientId(),
redirectUri: 'http://localhost:4200',
postLogoutRedirectUri: window.location.origin + '/',
isAngular: true
};
}
处理重定向的组件如下所示:
ngOnInit() {
this.adalService.handleWindowCallback();
if (this.adalService.userInfo.isAuthenticated) {
this.router.navigate(['/next']);
}
}
有人可以帮忙吗?
【问题讨论】:
标签: angular adfs angular-routing adal