mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-02 12:07:35 +08:00
docs(openid-connect): add Authentication through OIDC Relying Party flow description (#4978)
Co-authored-by: Peter Zhu <starszcan@gmail.com>
This commit is contained in:
parent
1855469198
commit
29367a58f9
@ -142,6 +142,43 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13
|
||||
}'
|
||||
```
|
||||
|
||||
#### 通过 OIDC 依赖方认证流程进行身份验证
|
||||
|
||||
当一个请求在请求头或会话 Cookie 中不包含访问令牌时,
|
||||
插件可以充当 OIDC 依赖方并重定向到身份提供者的授权端点以通过 OIDC 授权代码流程;
|
||||
请参阅 https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth 。
|
||||
一旦用户通过身份提供者进行身份验证,插件将代表用户从身份提供者获取和管理访问令牌和更多信息。
|
||||
该信息当前存储在会话 cookie 中,该插件将识别 cookie 并使用其中的信息,以避免再次执行认证流程。
|
||||
|
||||
以下命令将此操作模式添加到路由:
|
||||
|
||||
```bash
|
||||
curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
|
||||
{
|
||||
"uri": "/get",
|
||||
"plugins": {
|
||||
"proxy-rewrite": {
|
||||
"scheme": "https"
|
||||
},
|
||||
"openid-connect": {
|
||||
"client_id": "api_six_client_id",
|
||||
"client_secret": "client_secret_code",
|
||||
"discovery": "full_URL_of_the_discovery_endpoint",
|
||||
"bearer_only": false,
|
||||
"realm": "master"
|
||||
}
|
||||
},
|
||||
"upstream": {
|
||||
"type": "roundrobin",
|
||||
"nodes": {
|
||||
"httpbin.org:443": 1
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
在该例子中,插件可以强制在各自配置的请求头中设置访问令牌、ID 令牌和 UserInfo 对象。
|
||||
|
||||
## 故障排除
|
||||
|
||||
如果 APISIX 无法解析/连接到身份提供者,请检查/修改 DNS 设置(`conf / config.yaml`)。
|
||||
|
Loading…
Reference in New Issue
Block a user