我目前正在构建一个openid连接服务器,使用https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server和asp.net核心标识作为备份存储。我知道协议,流程和安全漏洞。
当前的设置如下:[server] -授权服务器和资源服务器[front-end] - angularJS应用程序[third-party-provider] - Google [external-app] -第二个应用程序希望使用来自服务器的令牌。
[front-end]和[external-app]都注册为[server]的客户端。因此,他们被允许检索令牌。登录页面构建在[front-end]中。
请记住,[front-end]应用程序显示了登录页面等(而不是从AccountController返回一个AuthView )。
想象一下,我想用[external-app]登录,从[server]获得一个身份。登录页面由[front-end]显示。然后,流程如下:
1. [external-app] -> http://[server]/account/authorize?client_id=[external-
app-clientid]&response_type=token&redirect_uri=http://[external-app-
redirecturi]
2. [front-end] -> matches route -> show login page
3. [front-end] -> user clicks on login with google
4. [front-end] -> redirect to 'http://[server]/account/authorize/connect?
provider=Google&redirect_uri=http://[front-
end]/account/thirdparty/authorized&response_type=code&client_id=[front-
end-clientid]
5. [server] -> no identity found, save request in session and let the user
login at the [third-party] (using ChallengeResult and also passing in the
request id which was stored in session)
6. [third-party-provider] user logs in
7. [front-end] -> http://[front-end]/account/thirdparty/authorized recieved
the code
8. [front-end] -> exchange authcode for token with [server] using
http://[server]/account/token&grant_type=authorization_code&code=
[code]&redirect_uri=http://[front-
end]/account/thirdparty/authorized&client=[front-end-clientid]
9. [server] -> generate claims and return token
10. [front-end] -> token recieved我缺少的(可能是实现缺陷、思想缺陷或其他什么)是,我需要用给定的令牌重定向回[external-app]。我需要在[front-end]上这样做吗?感觉很不对劲,我确定我混合/匹配的东西错了。有人能帮我吗?
提前感谢!
是的,我知道,应该是https。(例如,上述目的;)
发布于 2016-09-23 18:31:34
对于交互流(如隐式流),需要记住的重要一点是,您必须将用户重定向到身份提供者的授权端点,以便它有机会准备授权响应。
您可以自由决定身份提供者收到授权请求和返回授权响应之间会发生什么,但是您不能将用户从“前端”应用程序直接重定向到“外部应用程序”,因为它无法生成授权响应(它不是它的角色)。
考虑重新处理您的流程,以便您的前端应用程序将您的用户重定向到授权服务器,这本身就会将他们重定向到您的外部应用程序。
https://stackoverflow.com/questions/39658761
复制相似问题