Configuring single sign-on using OpenID Connect (OIDC)
Using OIDC, you can configure single sign-on (SSO) between your product and supported providers. You can configure OIDC with just-in-time (JIT) provision only.
OIDC is an authentication protocol layer that is built on the OAuth 2.0 protocol. It allows the third-party applications to:
- Verify the identity of the users.
- Get the basic profile information about the users.
The following steps represent the flow that happens during SSO configuration by using OIDC:
-
A user attempts to access a service in your product through a web browser.
-
Your product verifies whether an authentication token is present.
-
If no authentication token is present, your product redirects the request for authentication to the third-party authorization server of the user.
-
The authorization server presents a login page to the user.
-
If the user logs in successfully, the authorization server redirects the user, along with the OIDC response, to your product.
-
Your product generates an authentication token and grants access to the service that the user requested.
Note: You can use PKCE with OIDC for protection from authorization code interception attacks for OAuth 2.0 public clients. For more information, see PKCE support for OpenID Connect clients . The IM service enables PKCE by default. If your OIDC provider configures PKCE, you can use it for authentication in the IM login flow. If the OIDC provider does not configure PKCE, it does not impact the IM login flow.
Configuring SSO in your product by using OIDC
See the following notes:
-
You can configure SSO with OIDC support by using the IdP V3 APIs. For more information, see IdP V3 APIs.
-
Currently, OIDC is the only supported protocol with the IdP V3 version.
-
To verify whether you have OIDC support or not, see Getting the list of registered OIDC clients by query.
Before you begin
Log in to any of the following platforms by using the provided IdP links and register yourself in the application. During registration, use application URL as cp-console URL and redirect URL as https://<cp-console-url>/ibm/api/social-login/redirect/<name of the oidc>
.
Once you are registered, you can get the unique client ID, client secret and discovery_url
endpoint. Currently, only these platforms are verified to register the OIDC by using the IdP V3 API.
Platform | IdP link |
---|---|
IBM Security Verify (ISV) | https://www.ibm.com/docs/en/erqa?topic=using-security-verify-as-oidc-provider Note: Whenever you perform the attributes mapping through the OIDC provider in the ISV application, enable the Send all known user attributes in the ID token option. And, ISV groups must not contain spaces. |
Google Cloud Platform | https://cloud.google.com/identity-platform/docs/web/google |
Microsoft | https://cloud.google.com/identity-platform/docs/web/microsoft |
Okta | https://help.okta.com/en-us/Content/Topics/Apps/Apps_App_Integration_Wizard_OIDC.htm |
Procedure
To configure SSO, complete the following sequence of steps:
-
Register the OIDC clients. For more information, see Registering the OIDC clients.
-
Get the list of registered OIDC clients. For more information, see Getting the list of registered OIDC clients.
If you need to delete the registration of the client, see Deleting the registration of the client.
-
Open the Cloud Pak home page to verify whether the OIDC is successfully configured.
Note: After the OIDC is successfully configured, you can log in to the cp-console. However, to log in to the Cloud Pak Platform and to get the OIDC successfully configured, first you need to onboard the OIDC users into the Cloud Pak Platform. Then, the OIDC users are able to log in to the Cloud Pak Platform.
-
To authenticate, click the corresponding OIDC link in the Cloud Pak home page.
Granting an admin role to Cloud Pak Platform
Before you begin, onboard OIDC users into the Cloud Pak Platform.
Important: If you configure multiple authentication types (SAML, LDAP, and OIDC) in your cluster, and onboard same users to all the authentication types, the users might not be able to log in the first time by using OIDC. They might be able to log in the second time. To overcome the limitation, onboard users by following the instructions in Integrating IBM Cloud Pak SAML with Azure Active Directory.
Now, complete the following steps to grant an Admin role for Cloud Pak Platform. The procedure is based on the APIs.
-
Configure environmental variables:
-
Obtain an IM access token for the default admin user. For more information, see Preparing to run API commands.
-
Set the HOST environment variable. To get the host value, run the following command:
oc get route -n <your-foundational-services-namespace>
Set the HOST to the cp-console route. For example,
export HOST=<cp-console>
. -
Set CPHOST to the cpd route with corresponding
ibm-nginx-svc
service name. For example,CPHOST=cpd-cp4i.apps.bunny.cp.abc.ibm.com
.
-
-
Get the IBM Cloud Pak access token for the admin user.
curl -ki -X GET 'https://'$CPHOST'/v1/preauth/validateAuth' --header 'username: cpadmin' --header "iam-token: $TOKEN"
Note: The default
username
for the new cluster installation iscpadmin
. If you upgrade the existing cluster, the default username isadmin
. -
Create a user group with the role that you want to assign to the user.
curl -k -s -X POST 'https://'$CPHOST'/usermgmt/v2/groups' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header "Authorization: Bearer $CPTOKEN" \ -d '{"name": "isv group", "description": "Group default ISV group", "role_identifiers": ["zen_user_role"] }'
Note: To create an admin group, in "role_identifiers", specify the “zen_administrator_role”.
Verify whether the group is listed, and get the group ID:
curl -k -s -X GET 'https://'$CPHOST'/usermgmt/v2/groups' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header "Authorization: Bearer $CPTOKEN"
-
Add the
isv
group into the user groups:curl -k -s -X POST 'https://'$CPHOST'/usermgmt/v2/groups/<group_ID>/members' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header "Authorization: Bearer $CPTOKEN" \ -d '{ "ldap_groups": ["admin"] }'
In the command, the group_ID is the
isv
group ID that you got in the previous step.The configuration is complete.
-
Verify whether the user who is a member of the
isv
group can log in to Cloud Pak Platform with proper permissions. To verify, open the Cloud Pak Platform in your browser by using the URL of $CPHOST.