SSO module
Edition |
DX Core |
License |
|
Issues |
|
Maven site |
|
Latest |
1.1 |
The SSO module handles authentication for the instance on which it is installed. Read this page carefully and test the module on a development environment before proceeding to ensure installation does not break your instance. |
The Magnolia SSO module delegates authentication from a Magnolia instance to an OpenID Connect identity and access management application. The current iteration of the module has been successfully tested with open source Keycloak and cloud identity management software Okta, but all providers that follow the protocol should also be supported.
As Magnolia is already capable of full-fledged security, the intent is to only replace the authentication mechanism. A user on a third-party system with roles and groups is mapped to the equivalent Magnolia user roles and groups.
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.sso</groupId>
<artifactId>magnolia-sso</artifactId>
<version>1.1</version>
</dependency>
Configuration
Prerequisites
A running Open ID Connect IAM instance on which you have administrative rights is required for the setup to work. As Keycloak is open source and can be deployed locally, it’ll be used as an example in the instructions below. But any IAM instance should work, as long as it is configured in a similar manner.
Keycloak’s own Server Administration Guide is an excellent resource to help with configuring the properties that’ll get brought up below. |
If you use Keycloak and intend to deploy it by code, then take a look at the SsoModuleIT class and the module’s test Docker Compose setup. The module’s integration tests configure Keycloak from scratch. |
Prerequisite | Description |
---|---|
a user |
required Its username and password will be used to access Admincentral. It should have names as well as an email. |
a group |
required When the user logs in, it has to belong (in Keycloak’s eyes, that is either in Keycloak directly, or in a user federation provider) to at least one group defined in the group mappings. That’s how the necessary access to Magnolia will be granted. |
an OIDC client |
required With the following properties: |
a name |
required Must be the same as the one used in the YAML configuration of the module. |
the |
required |
a confidential access type |
required This is required in order for Keycloak to generate credentials. |
credentials |
required Those must be shared with the YAML configuration of the module. |
a redirect URI |
required That points back to Magnolia, e.g. |
a Group Membership mapper |
required This is required in order to include the user’s groups in the |
YAML configuration
This section explains how to configure the SSO module. This is most easily done with a YAML decorator.
From a light module, use the following path structure:
<MODULE_NAME>/decorations/magnolia-sso/config.yaml
authenticationService:
path: /.magnolia/admincentral (1)
callbackUrl: http://localhost:8080/.auth (2)
groupMappings: (3)
/magnolia-sre:
roles:
- superuser
pac4j: (4)
oidc.id: magnolia-sso (5)
oidc.secret: 2ff75b44-c7ef-4932-91c8-59e6ea5f35b6 (6)
oidc.scope: openid profile email (7)
oidc.discoveryUri: https://<YOUR_OIDC_IDP_DOMAIN>/…/.well-known/openid-configuration (8)
oidc.preferredJwsAlgorithm: RS256 (9)
Property | Description | |||
---|---|---|---|---|
1 |
|
required Describes on which path the SSO module should kick in. |
||
2 |
|
required URL of Magnolia’s callback servlet. It is made up of the instance’s absolute URL, in this case |
||
3 |
|
required Lets you handle different levels of security. Given a user’s groups on a 3rd-party IAM management instance, it will map it to one or multiple Magnolia roles. Mapping an OIDC group to a Magnolia group is also possible, but not working yet (see MGNLSSO-38). The example above assigns the
|
||
4 |
|
required Properties to be forwarded to the pac4j library in order to build a configuration that can then be used by the library. See pac4j’s page on the configuration module for more details. |
||
5 |
|
required Name of the OIDC client that is configured to allow the Magnolia instance to access the IAM instance.
|
||
6 |
|
required Secret created by the IAM instance when the client is created. |
||
7 |
|
required Defines which data about the user the Magnolia instance should be allowed to request from OIDC.
|
||
8 |
|
required The IAM instance’s auth endpoint URL. This must be tweaked according to your project. |
||
9 |
|
required The JWS algorithm that is going to be used by pac4j. We recommend |
Configure JAAS
The instance’s JAAS configuration (see JAAS security set up) must be amended:
sso-authentication {
info.magnolia.sso.jaas.SsoAuthenticationModule requisite;
info.magnolia.jaas.sp.jcr.JCRAuthorizationModule required;
};