|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * hosted_control_planes/hcp-authentication-authorization.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="hcp-configuring-oauth_{context}"] |
| 7 | += Configuring the internal OAuth server for a hosted cluster |
| 8 | + |
| 9 | +You can configure the internal OAuth server for your hosted cluster by using an OpenID Connect identity provider. Adding any identity provider in the OAuth configuration removes the default `kubeadmin` user provider. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You created your hosted cluster. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Edit the `HostedCluster` custom resource (CR) on the hosting cluster by running the following command: |
| 18 | ++ |
| 19 | +[source,terminal] |
| 20 | +---- |
| 21 | +$ oc edit <hosted_cluster_name> -n <hosted_cluster_namespace> |
| 22 | +---- |
| 23 | + |
| 24 | +. Add the OAuth configuration in the `HostedCluster` CR by using the following example: |
| 25 | ++ |
| 26 | +[source,yaml] |
| 27 | +---- |
| 28 | +apiVersion: hypershift.openshift.io/v1alpha1 |
| 29 | +kind: HostedCluster |
| 30 | +metadata: |
| 31 | + name: <hosted_cluster_name> <1> |
| 32 | + namespace: <hosted_cluster_namespace> <2> |
| 33 | +spec: |
| 34 | + configuration: |
| 35 | + oauth: |
| 36 | + identityProviders: |
| 37 | + - openID: <3> |
| 38 | + claims: |
| 39 | + email: <4> |
| 40 | + - <email_address> |
| 41 | + name: <5> |
| 42 | + - <display_name> |
| 43 | + preferredUsername: |
| 44 | + - <preferred_username> <6> |
| 45 | + clientID: <client_id> <7> |
| 46 | + clientSecret: |
| 47 | + name: <client_id_secret_name> <8> |
| 48 | + issuer: https://example.com/identity <9> |
| 49 | + mappingMethod: lookup <10> |
| 50 | + name: IAM |
| 51 | + type: OpenID |
| 52 | +---- |
| 53 | +<1> Specifies your hosted cluster name. |
| 54 | +<2> Specifies your hosted cluster namespace. |
| 55 | +<3> This provider name is prefixed to the value of the identity claim to form an identity name. The provider name is also used to build the redirect URL. |
| 56 | +<4> Defines a list of attributes to use as the email address. |
| 57 | +<5> Defines a list of attributes to use as a display name. |
| 58 | +<6> Defines a list of attributes to use as a preferred user name. |
| 59 | +<7> Defines the ID of a client registered with the OpenID provider. You must allow the client to redirect to the `\https://oauth-openshift.apps.<cluster_name>.<cluster_domain>/oauth2callback/<idp_provider_name>` URL. |
| 60 | +<8> Defines a secret of a client registered with the OpenID provider. |
| 61 | +<9> The link:https://openid.net/specs/openid-connect-core-1_0.html#IssuerIdentifier[Issuer Identifier] described in the OpenID spec. You must use `https` without query or fragment component. |
| 62 | +<10> Defines a mapping method that controls how mappings are established between identities of this provider and `User` objects. |
| 63 | + |
| 64 | +. Save the file to apply the changes. |
0 commit comments