本文整理汇总了TypeScript中aurelia-authentication.AuthService类的典型用法代码示例。如果您正苦于以下问题:TypeScript AuthService类的具体用法?TypeScript AuthService怎么用?TypeScript AuthService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthService类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: next
run(navigationInstruction: router.NavigationInstruction, next: router.Next) {
if (!navigationInstruction.fragment.startsWith('/app'))
return next();
var isAuthenticated = this.authService.isAuthenticated();
if (!isAuthenticated) {
return next.cancel(new router.Redirect('signin'));
}
return next();
}
示例2: activate
activate() {
// When we get to the logout route, the logout
// method on the auth service will be called
// and we will be redirected to the login view
this.auth.logout("#/login")
.then(response => {
console.log("Logged Out");
})
.catch(err => {
console.log("Error Logging Out");
});
};
示例3: authenticateLinkedin
authenticateLinkedin() {
return this.authService.authenticate('linkedin')
.then(() => {
return;
});
}
示例4: activate
activate() {
// since its stateless, we only need to delete the token in the browsers storage
this.auth.logout();
}
示例5: authenticated
get authenticated() {
return this.authService.isAuthenticated();
}