4.3.2. 为红帽单点登录身份验证配置 OpenShift Master
登录 OpenShift 主控机 CLI。
前提条件
您必须具有编辑 /etc/origin/master/master-config.yaml 文件的权限。
流程
编辑 /etc/origin/master/master-config.yaml 文件并找到 identityProviders 部分。例如,如果 OpenShift 主控机配置了 HTPassword 身份提供程序,则 identityProviders 部分类似如下:
identityProviders: - challenge: true login: true name: htpasswd_auth provider: apiVersion: v1 file: /etc/origin/openshift-passwd kind: HTPasswdPasswordIdentityProvider
添加 Red Hat Single Sign-On 作为二级身份提供程序,其内容类似于以下代码片段:
- name: rh_sso challenge: false login: true mappingMethod: add provider: apiVersion: v1 kind: OpenIDIdentityProvider clientID: openshift-demo clientSecret: 7b0384a2-b832-16c5-9d73-2957842e89h7 ca: xpaas.crt urls: authorize: https://secure-sso-sso-app-demo.openshift32.example.com/auth/realms/OpenShift/protocol/openid-connect/auth token: https://secure-sso-sso-app-demo.openshift32.example.com/auth/realms/OpenShift/protocol/openid-connect/token userInfo: https://secure-sso-sso-app-demo.openshift32.example.com/auth/realms/OpenShift/protocol/openid-connect/userinfo claims: id: - sub preferredUsername: - preferred_username name: - name email: - email
-
clientSecret 的 Red Hat Single Sign-On Secret hash 位于 Red Hat Single Sign-On web 控制台中: Clients
openshift-demo Credentials 通过 Red Hat Single Sign-On 应用发出请求,可以找到 urls 的端点。例如:
<curl -k https://secure-sso-sso-app-demo.openshift32.example.com/auth/realms/OpenShift/.well-known/openid-configuration | python -m json.tool>
响应包括 authorization_endpoint、token_endpoint 和 userinfo_endpoint。
- 这个示例工作流使用自生成的 CA 为演示目的提供端到端工作流。因此,ca 作为 < ca: xpaas.crt> 提供。此 CA 证书还必须复制到 /etc/origin/master 文件夹。如果使用从验证的证书颁发机构购买的证书,则不需要这样做。
-
clientSecret 的 Red Hat Single Sign-On Secret hash 位于 Red Hat Single Sign-On web 控制台中: Clients
保存配置并重启 OpenShift master:
$ systemctl restart atomic-openshift-master