SSO module

Edition

DX Core

License

MLA

Issues

MGNLSSO

Maven site

SSO

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 openid-connect protocol

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. http://localhost:8080/*.

     a Group Membership mapper

required

This is required in order to include the user’s groups in the groups property, see GroupsAuthorizationGenerator.

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

path

required

Describes on which path the SSO module should kick in. /.magnolia/admincentral is the default for most cases.

2

callbackUrl

required

URL of Magnolia’s callback servlet. It is made up of the instance’s absolute URL, in this case http://localhost:8080, as well as the relative path to the SSOCallbackServlet, which is /.auth by default.

3

groupMappings

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 superuser role to a group of administrators.

On a production system, you will want to map editors to a Magnolia role with editing rights.

4

pac4j

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

     oidc.id

required

Name of the OIDC client that is configured to allow the Magnolia instance to access the IAM instance.

This can be anything but must share the same name as configured in the IAM instance.

6

     oidc.secret

required

Secret created by the IAM instance when the client is created.

7

     oidc.scope

required

Defines which data about the user the Magnolia instance should be allowed to request from OIDC.

The openid, profile, and email scopes are mandatory in order for Magnolia to create a user account with basic information about the user.

8

     oidc.discoveryUri

required

The IAM instance’s auth endpoint URL. This must be tweaked according to your project.

9

     oidc.preferredJwsAlgorithm

required

The JWS algorithm that is going to be used by pac4j. We recommend RS256 because it has broad support, but this can be changed here. You can find more details in the following algorithm selection guide.

Configure JAAS

The instance’s JAAS configuration (see JAAS security set up) must be amended:

JAAS configuration
sso-authentication {
  info.magnolia.sso.jaas.SsoAuthenticationModule requisite;
  info.magnolia.jaas.sp.jcr.JCRAuthorizationModule required;
};

Module compatibility

Module version Magnolia CMS version

1.1

6.2.5

Module version 3rd party API

1.1

Tested against Keycloak 9.0.3

1.1

Tested against Okta 2021.03.3 onwards

Feedback