Identity Server 4 Angular 2令牌过期

时间:2017-02-10 15:15:55

标签: angular oauth openid-connect identityserver4

我正在寻找有关如何使用Angular 2和Identity Server 4最好地处理令牌过期的建议。我使用了不会发出刷新令牌的Identity Server 4的隐式流程和我在令牌过期后,我们不想重定向用户。

另外,为什么没有刷新令牌呢?为什么javascript客户端的混合流程不起作用?我控制ID服务器,应用程序和api,这样可以吗?

1 个答案:

答案 0 :(得分:6)

我可以推荐用于管理javascript应用程序令牌的库: https://github.com/IdentityModel/oidc-client-js

您已正确使用SPA的隐式流程 - 以下是关于哪个流程正确的说明 - https://leastprivilege.com/2016/01/17/which-openid-connectoauth-2-o-flow-is-the-right-one/

Files.write提供了名为List<String> filtered = Files.lines(Paths.get(filename)). filter(x -> x.contains("yes")).collect(Collectors.toList()); Files.write(Paths.get("Output.txt"),filtered); - check the docs的强大功能。后台有计时器,在令牌过期前处理事件,并使用隐藏的iframe获取新的访问令牌。

Oidc-clientautomaticSilentRenew的示例: https://github.com/jmurphzyo/Angular2OidcClient

视频,概述了使用IdentityServer的JavaScript Web应用程序中的身份验证和授权 - https://vimeo.com/131636653