認證過程:
1 :請求資源要加上 access_token 頭。一般是 jwt 格式的 bearer
234 :一般都封裝了,直接配置 認證服務器的地址(下圖auth,比如 http:locahost:8000)+自己的名字(在auth的眼里叫做 APIResource) 即可。ps:也可以自己寫過濾器或者中間件來實現。
授權過程:授權碼模式,從下往上看
identityservice4 驗證和 jwt token 生成過程
用戶登錄並確定授權范圍成功后:
- auth 發放授權碼
- client 用授權獲請求 auth
- auth 驗證client
- auth 驗證 scope
- auth 驗證 apiresource
- auth 組裝 Claim 數據
- 從 client 獲取 claim
- 從 IProfileService 接口實現獲取
- 根據 claimtypes 篩選
- auth 把篩選出的 claim 生成到 jwt 格式 acces_token 中