Configure SSO with SAML¶
Description¶
In this tutorial you will learn how to configure OnSphere to delegate authentication to a SAML server.
Steps¶
1. Add the certificate¶
SAML using a not-self signed certificate
Open the
/modules/keycloak/keycloak-1/module.keycloak
fileSet the
includeSystemCA
flag to true.
SAML using a self signed certificate
On the configuration create the
certs/external
folder if it doesn’t exist.Add the CA certificate as PEM into
certs/external
.Push the new configuration.
Restart the
Keycloak
module.
2. Configure the server¶
With the keycloak front-end (Recommended because it simplifies the test)
Access the Keycloak administration console
https://<stack_ip>:<stack_port>/auth/admin
(for example https://stack-1.onsphere.local:5000/auth/admin).Login to Keycloak administration console using administration user and password configured when the stack was deployed (see System security).
Access the
Identity Providers
tab.Select
SAML v2.0
on theAdd provider
menu.At the bottom of the page under
Import External IDP Config
Use the url providing the
FederationMetadata.xml
of your AD to configure it.Directly import the
FederationMetadata.xml
.
Configure your SAML server with the metadata from keycloak
https://<stack ip or hostname>:<port>/auth/realms/onsphere/protocol/saml/descriptor
.Configuration of the identifier for the user
AD
Keycloak
When a user uses the Identity provider for the first time, it will need to provide an email, username, name and firstname.
This step is skipped if the mapper for the field is configured.
Once everything is working properly, you can export the configuration and integrate it to the OnSphere configuration.
Go to the
Export
menu on the left and clickExport
In the downloaded file search for
IdentityProviders
andidentityProviderMappers
Copy the identity provider.
Open or create the
/modules/keycloak/keycloak-1/identityProvider.keycloak
fileAdd the following content if missing
{
"identityProviders": [],
"identityProviderMappers": []
}
Add the copied identity provider to the list.
Remove all id to avoid any conflict.
See osp-keycloak for a complete federation file.
With the configuration file
Copy osp-keycloak complete identity provider file.
Add its content to the
/modules/keycloak/keycloak-1/identityProviders.keycloak
fileUpdate the file base on your LDAP configuration
Push the configuration
Check the keycloak logs to see if there are any errors.
If necessary modify the configuration to fix the errors.
Access the Keycloak administration console https://{stack_ip}:{stack_port}/auth/admin (for example https://stack-1.onsphere.local:5000/auth/admin).
Login to Keycloak administration console using administration user and password configured when the stack was deployed (see System security).
Check if the groups and user are properly created.