我目前正在建立一個使用https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server和asp.net核心身份作爲後備存儲的openid連接服務器。我知道協議,流程和安全漏洞。openidconnect.server,第三方提供商和重定向
當前設置如下: [server]
- 授權服務器&資源服務器 [front-end]
- 一個angularJS應用 [third-party-provider]
- 谷歌 [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]
上做到這一點?它的感覺和我有點確定我混合/匹配的東西錯了。誰能幫我嗎?
在此先感謝!
PS是的,我知道,應該是https。以上僅爲舉例目的;)
您確定要構建自己的openid連接服務器嗎?您可能有充分的理由這麼做,但我想我會提及已經實施的解決方案,它完全符合您要實現的目標。看看Identity Server:https://github.com/IdentityServer/IdentityServer4 – henningst
我目前使用https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server,所以我沒有做這一切都在我自己的...但我需要有一些幫助重定向流:)我會更新我的問題,以反映即時通訊使用這個庫的事實! –