我目前正在使用https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server和 asp.net 核心身份作为后备存储构建我的 openid 连接服务器。我知道协议、流程和安全漏洞。
当前设置如下:
[server]
- 授权服务器和资源服务器
[front-end]
- 一个 angularJS 应用程序
[third-party-provider]
- Google
[external-app]
- 第二个应用程序,它想使用来自 [server] 的令牌
[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]
吗?感觉不对,我有点确定我混合/匹配的东西是错误的。谁能帮我吗?
提前致谢!
PS是的,我知道,应该是https。以上是例如目的;)