Use this procedure to configure {Project} settings for {Keycloak} authentication using the {Project} CLI.
Note that you can navigate to the following URL within your realm to obtain values to configure {Project} settings: https://{Keycloak-short}.example.com/auth/realms/{Project}_Realm/.well-known/openid-configuration
-
Ensure that the Access Type setting in the {Project} client in the {Keycloak} web UI is set to public
-
On {Project}, set the login delegation to
true
so that users can authenticate using the Open IDC protocol:# hammer settings set --name authorize_login_delegation --value true
-
Set the login delegation logout URL:
# hammer settings set --name login_delegation_logout_url \ --value https://{foreman-example-com}/users/extlogout
-
Set the algorithm for encoding on {Keycloak}, for example,
RS256
:# hammer settings set --name oidc_algorithm --value 'RS256'
-
Open the
{Keycloak-short}.example.com/auth/realms/{Keycloak-short}_REALM/.well-known/openid-configuration
URL and note the values to populate the options in the following steps. -
Add the value for the Hammer client in the Open IDC audience:
# hammer settings set --name oidc_audience \ --value "['{foreman-example-com}-hammer-openidc']"
NoteIf you register several {Keycloak} clients to {Project}, ensure that you append all audiences in the array. For example:
# hammer settings set --name oidc_audience \ --value "['{foreman-example-com}-foreman-openidc', '{foreman-example-com}-hammer-openidc']"
-
Set the value for the Open IDC issuer:
# hammer settings set --name oidc_issuer \ --value "{Keycloak-short}.example.com/auth/realms/{Keycloak-short}_Realm"
-
Set the value for Open IDC Java Web Token (JWT):
# hammer settings set --name oidc_jwks_url \ --value "{Keycloak-short}.example.com/auth/realms/{Keycloak-short}_Realm/protocol/openid-connect/certs"
-
Retrieve the ID of the {Keycloak} authentication source:
# hammer auth-source external list
-
Set the location and organization:
# hammer auth-source external update --id Authentication Source ID \ --location-ids Location ID --organization-ids Organization ID