Create clients in Keycloak for OIDC in StorageGRID
Use Keycloak to create a client connection for each Admin Node for OpenID Connect (OIDC) in your StorageGRID system.
-
You have experience creating clients in Keycloak, or you have access to the Keycloak documentation.
-
You have a dedicated account (Bind DN) for directory lookups and the login credentials.
-
You have Keycloak Administrator access.
Each Admin Node in your StorageGRID system must have a client connection. This ensures that users can securely sign in to and out of any Admin Node. You can create a single client connection for all Admin Nodes (recommended) or a different client connection for each Admin Node.
Use the default settings unless otherwise specified. In some cases you can use settings required by your organization.
Step 1: Optionally, create a realm
Create a Keycloak realm to configure the LDAP provider and OIDC client, or use the Keycloak default realm.
-
Select Create Realm.
-
Enter a name for the realm.
-
Select Enabled.
-
Select Create.
Step 2: Configure LDAP provider
Configure the LDAP provider so that Keycloak connects to the Active Directory Federation Service (AD FS) LDAP server.
-
Select User federation > Add Ldap providers.
-
Under the Settings tab:
-
Enter the following recommended values:
-
UI display name: Enter a unique value.
-
Vendor: Active Directory
-
Connection URL:
ldap://<ldap_IP_address>orldaps://<ldap_IP_address> -
Connection pooling: ON
-
Bind DN: Enter your Bind DN
-
Bind credentials: Enter password
-
Edit mode: READ_ONLY
-
Users DN: For example,
CN=Users,DC=saml,DC=sgws -
Username LDAP attribute: sAMAccountName
-
RDN LDAP attribute: cn
-
UUID LDAP attribute: objectGUID
-
User object classes:
person,organizationalPerson,user -
User LDAP filter:
(sAMAccountName=*) -
Search scope: Subtree
-
Pagination: ON
-
Import users: ON
-
Sync registrations: ON
-
Remove invalid users during searches: ON
-
-
Select Test connection and Test authentication.
Resolve any issues that might occur before continuing.
-
-
Select Save.
Step 3: Configure LDAP mapping
Configure LDAP mapping to map AD as an attribute to Keycloak.
-
Go to User federation > LDAP
-
Select the LDAP provider you created.
-
On the Mappers tab, select Add mapper > Create new mapper.
-
For Mapper Type, select user-attribute-ldap-mapper.
-
Select Save, then enter the following information:
-
User Model Attribute: userPrincipalName
-
LDAP Attribute: userPrincipalName
-
Read Only: ON
-
Always Read Value From LDAP: ON
-
Is mandatory in LDAP: OFF
-
Force a Default value: ON
-
Is Binary Attribute: OFF
-
-
Select Save.
Step 4: Create OIDC client
Create the OIDC client for your system.
-
Go to Clients > Create client.
-
For General settings, enter the following information:
-
Name: Enter a display name for the client.
-
Client type: OIDC Connect
-
Client ID: Enter a unique value. Save this value for use later.
-
-
Select Next.
-
For Capability config, enter the following information:
-
Client authentication: ON
-
Standard flow: Enable
-
Direct access grants: Enable
-
Service account roles: Enable
-
-
Select Next.
-
For Login settings, enter the redirect URIs:
If one or more load balancer endpoints are configured for the management interface, add the redirect URIs for each port. For example: https://<Admin_IP_address_or_FQDN>:<port>/api/v4/oidc-callbackandhttps://<Admin_IP_address_or_FQDN>:<port>/api/v4/oidc-logged-out-
Valid redirect URIs:
https://<Admin_IP_address_or_FQDN>/api/v4/oidc-callbackandhttps://<Admin_IP_address_or_FQDN>/api/v4/oidc-logged-out -
Valid post logout redirect URIs:
https://<Admin_IP_address_or_FQDN>/api/v4/oidc-logged-out -
Web origins:
https://<Admin_IP_address_or_FQDN>
-
-
Select Save.
Step 5: Generate client secret
Generate a client secret for the OIDC client you created.
-
Go to Clients, then select the OIDC client you created.
-
On the Credentials tab, enter the following information:
-
Client authenticator: Client Id and Secret
-
Client secret: Generate or set a client secret. Save this value for use later.
-
Step 6: Define scopes
Define the scopes in Keycloak.
-
Go to Client scopes > Create client scope, then enter the following information:
-
Type: None
-
Protocol: OpenID Connect
-
Display on consent screen: Enabled
-
Include in OpenID Provider Metadata: Enabled
-
-
Select Save.
-
On the Mappers tab, select Configure a new mapper > User Attribute, then enter the following information:
-
Name: Enter a unique value.
-
User Attribute: userPrincipalName
-
Token Claim Name: upn
-
Claim JSON Type: String
-
Add to ID token: ON
-
Add to access token: ON
-
Add to userinfo: ON
-
Add to token introspection: ON
-
-
Select Save.
-
Go to Clients and select the OIDC client you created.
-
Select Client Scopes > Add client scope.
-
Select the client scope you created.
-
Select Add.
Step 7: Prepare to configure SSO using OIDC
Save the information required to configure SSO with OIDC using Keycloak in your StorageGRID system.
-
Check that you've saved the client ID and the client secret from the OIDC client you created.
-
Save the OpenID Connect discovery endpoint for the realm. This is available in the
well-knownconfiguration endpoint:https://<keycloak_host_ip/keycloak_host_name>/realms/<realm_name>/.well-known/openid-configurationOptionally include the network port:
https://<keycloak_host_ip/keycloak_host_name>:<https_port>/realms/<realm_name>/.well-known/openid-configuration
After creating OIDC clients, configure SSO using OIDC.