Menu Close
6.6.5. 使用 OpenID Connect 定义产品身份验证
您可以为 3scale 产品部署产品
自定义资源,该产品使用 OpenID Connect (OIDC)对任何 OAuth 2.0 流进行身份验证。3scale 与 OpenID Connect 等第三方身份提供程序(IdP)集成,以验证 API 请求。有关 OpenID Connect 的更多信息,请参阅 OpenID Connect 集成。与第三方 IdP 集成后,您将有两种类型的数据需要与产品自定义资源包含:
-
issuerType
:在与第三方 IdP 集成时,使用红帽单点登录(RH-SSO)以及其余
值时,会使用keycloak
值。 -
issuerEndpoint
:含有所需凭据的 URL。
先决条件
- 您必须配置 RH-SSO。请参阅 配置红帽单点登录。
- 您必须 配置 HTTP 与第三方身份提供程序的集成。
注意
issuerEndpoint
中提供的 CLIENT_ID 和 CLIENT_CREDENTIALS 凭据必须具有足够的权限来管理域中的其他客户端。
步骤
确定端点
issuerEndpoint
,它定义 OpenID 供应商的位置,并在产品自定义资源中使用此格式:https://<client_id>:<client_secret>@<host>:<port_number>/auth/realms/<realm_name>`
定义或更新 3scale
产品
CR,为任何 OAuth 2.0 流指定 OpenID Connect(OIDC)身份验证。例如:apiVersion: capabilities.3scale.net/v1beta1 kind: Product metadata: name: product1 spec: name: "OperatedProduct 1" deployment: <any>: authentication: oidc: issuerType: "keycloak" issuerEndpoint: "https://myclientid:myclientsecret@mykeycloack.example.com/auth/realms/myrealm" authenticationFlow: standardFlowEnabled: false implicitFlowEnabled: true serviceAccountsEnabled: true directAccessGrantsEnabled: true jwtClaimWithClientID: "azp" jwtClaimWithClientIDType: "plain"
创建您刚刚定义的资源。例如:
oc create -f product1.yaml
对于给定示例,输出为:
product.capabilities.3scale.net/product1 created
其他资源