Single Sign-On¶
Single Sign-On (SSO) allows users to log in to multiple applications with a single set of credentials. In MAAS, you can configure SSO using an external identity provider (IdP) that supports the OpenID Connect (OIDC) protocol.
This guide explains how to configure SSO using an OIDC-compliant IdP in MAAS.
Prerequisites¶
Before you begin, ensure you have completed the following prerequisites:
Set Up an OIDC-compliant Identity Provider¶
Ensure your OIDC-compliant IdP is set up and configured. This IdP will handle user authentication and provide the necessary information for MAAS to integrate with it. Register a new application with your IdP for MAAS, and keep the following details handy:
Client ID: The unique identifier for your application registered with the IdP.
Client Secret: The secret key associated with your application.
Issuer (IdP) URL: The URL of your identity provider’s authorization server.
Expected access token format: Ensure you know the format of the access tokens issued by your IdP (JWT or opaque) as this will be needed later.
MAAS supports the following IdPs:
Other OIDC-compliant IdPs may also work with MAAS, but are not officially supported or tested.
MAAS provides full UI and CLI authentication support for the providers listed above. For CLI authentication, MAAS performs user validation with the identity provider, which is currently implemented only for Auth0, Microsoft Entra ID, and Keycloak.
When using any other OIDC provider, UI authentication may still work and the CLI can still be used. However, MAAS does not contact the identity provider to verify that the authenticated user exists or is enabled. Managing user status, in these cases, is therefore the responsibility of the identity provider and its configuration.
Enable TLS in MAAS¶
The OpenID Connect specification requires that communication between the client (MAAS) and the IdP is secure. Ensure that TLS is enabled in your MAAS deployment. You can configure TLS by following the instructions in Configuring TLS.
Set up an Admin User¶
Configuring SSO in MAAS requires administrator privileges. Ensure you have created an admin user before continuing. You can do this by following the instructions in Creating an admin account.
Setting up a provider in MAAS¶
In the MAAS Web UI, go to the Single Sign-On configuration page. This can be found in Settings > User Management > OIDC/Single sign-on (/MAAS/r/settings/user-management/single-sign-on). Fill out the details for your OIDC provider:
Name: A display name for this provider inside MAAS. This name will appear on the login page so users can select it. It does not need to match any name used in the IdP configuration.
Vendor: The vendor of your IdP. If your IdP is not listed, select “Generic”.
Client ID: The Client ID you obtained from your IdP.
Client Secret: The Client Secret you obtained from your IdP.
Issuer URL: The base OpenID Connect issuer URL of your Identity Provider. MAAS uses this URL to discover the IdP’s authentication, token, and user information endpoints automatically (via OIDC discovery).
Redirect URI: This is the MAAS URI that your IdP will redirect to after authentication. Unless you have specific requirements (such as network proxies), this should be set to your MAAS URL followed by
/r/login/oidc/callback. This exact URI must also be registered in your IdP’s OAuth/OIDC client configuration.Scopes: A space-separated list of scopes MAAS will request from the IdP. The exact scope names you need will depend on your IdP and its configuration, but in general, MAAS requires the
openid,profile,emailandoffline_accessscopes to function properly.Token Type: The expected access token format issued by your IdP.
JWT: A signed token that MAAS can validate locally.
Opaque: A token that must be validated by the IdP.
If unsure, select Opaque or check your IdP documentation.
Once you save the configuration, MAAS will attempt to discover the necessary endpoints from the IdP. If discovery is successful, you are ready to use SSO.
Setting up Auth0 as an IdP¶
Open an account on Auth0 and log in to the Auth0 dashboard.
After logging in, go to
Applications>Applicationsfrom the left-hand menu. Then, click theCreate Applicationbutton.Give your application a name, and select
Regular Web Applicationas the application type. ClickCreate.Go to the
Settingstab of your newly created application. Scroll to theApplication URIssection and set theAllowed Callback URLsto your MAAS URL followed by/r/login/oidc/callback.For example, if your MAAS URL is
https://example.com:5443/MAAS, set the callback URL tohttps://example.com:5443/MAAS/r/login/oidc/callback.
Scroll down to the
Advanced Settingssection, and click on theGrant Typestab.Ensure that the
Authorization Code,Refresh Token, andClient Credentialsgrant types are enabled.
Select
Save.Scroll to the top, and go to the
API Accesstab for your application.For the
Auth0 Management APIrow, click theEditbutton.Go to the
Client Accesstab.Search for and select the
read:userspermission.Click
Grant Accessto save the changes.
Auth0 is now ready to be used with MAAS. From the
Settingstab, copy theClient ID,Client Secret, andDomain(which will be used as the Issuer URL) to configure your provider in MAAS.
Setting up Microsoft Entra ID as an IdP¶
Create an account and log in to the Microsoft Entra admin center.
From the left-hand menu, under the
Entra IDsection, selectApp registrations>New registration.Give your application a name. For the redirect URI, select
Weband enter your MAAS URL followed by/r/login/oidc/callback. ClickRegister.Note the
Directory (tenant) IDandApplication (client) IDfrom the application overview page.Your issuer URL will be in the format
https://login.microsoftonline.com/<Directory (tenant) ID>/v2.0.
Go to the
Certificates & secretstab, and clickNew client secret.Add a description and select an expiration period. Click
Add.Note the generated client secret value, as it will not be shown again.
Go to the
API permissionstab, and clickAdd a permission.Select
Microsoft Graph>Delegated permissions.Search for and select the following permissions:
openid,profile,email, andoffline_access. ClickAdd permissions.
Click
Add a permissionagain.Select
Microsoft Graph>Application permissions.Search for and select the following permission:
Directory.Read.All. ClickAdd permissions.Click
Grant admin consent for Default Directoryto grant the permissions you just added.
Entra ID is now ready to be used with MAAS. Use the
Application (client) ID,Client Secret, and the issuer URL you constructed earlier to configure your provider in MAAS.
Setting up Keycloak as an IdP¶
Ensure keycloak is running and accessible. Log in to the Keycloak admin console.
From the left-hand menu, select
Clients>Create client.Enter a Client ID, a name and a description. Then, click
Next.Enable
Client authenticationand ensureStandard flowandService account rolesare enabled. ClickNext.Add the redirect URI for your MAAS instance, which should be your MAAS URL followed by
/r/login/oidc/callback. ClickSave.
Go to the
Credentialstab and note theSecretvalue. This will be used as the Client Secret in MAAS.Go to the
Service account rolestab.Click
Assign role>Client roles.Search for and select the
view-usersrole. ClickAssign.
To create a test user, go to the
Userssection in the left-hand menu and clickAdd user.Fill in the required details and click
Create.Go to the
Credentialstab for the user and set a password. Ensure that you disable the “Temporary” option so that the user can log in without being forced to change their password.
Keycloak is now ready to be used with MAAS. Use the Client ID, Client Secret, and the issuer URL (which is typically in the format
https://<keycloak-domain>/realms/master, if you are using the master realm) to configure your provider in MAAS.
Use Single Sign-On¶
To test the IdP configuration:
Log out of MAAS if you are currently logged in.
Go to the MAAS login page.
Enter a username that exists in your IdP and is not a local MAAS user.
Click the “Sign in with [Provider Name]” button that corresponds to the provider you just configured.
You will be redirected to your IdP’s login page. Enter the credentials for the user you want to log in as.
After successful authentication, you will be redirected back to MAAS and logged in as that user. MAAS will create a new user profile based on the information received from the IdP.
Note that Single Sign-On does not replace local login. Local users will still have access to the regular password-based authentication.
Tear down¶
To remove the SSO configuration, simply go back to the Single Sign-On configuration page in the MAAS Web UI and delete the provider you created by clicking the Reset SSO configuration button. This will also delete any MAAS users created through that provider. If you wish to disable the provider without deleting it, run:
maas $PROFILE oidc-provider update <id> enabled=False
where <id> is the ID of the provider you want to disable.
Troubleshooting¶
Encountering conflict exceptions when creating/updating a provider¶
This occurs due to two reasons:
You are attempting to create or update a provider with a name that is already used by another provider. Provider names must be unique.
You are attempting to create or update a provider with
enabled=True, but another provider is already enabled. MAAS currently supports only one enabled OIDC provider at a time. Ensure you have disabled the currently enabled provider before enabling another one.
Deleting an enabled provider from the API/CLI¶
When attempting to delete a provider using the REST API or CLI, you may encounter the error message: “Provider is currently enabled and cannot be deleted.”
Ensure you disable the provider before deleting it.
Encountering post-login redirect errors¶
After signing in at your IdP, you may sometimes encounter redirect errors depending on your IdP configuration. Common causes include:
Your provider configuration restricts logins to specific email domains, but the account you used belongs to a different domain.
The Redirect URI in your MAAS provider configuration does not exactly match the URI registered in your IdP, causing the IdP to reject the authentication response.
The IdP is not configured to allow the scopes requested by MAAS (for example
openid,profile,email, oroffline_access), so the authentication response is rejected.