A copy of the content of this page has been moved to JAAS security setup page in the main Magnolia documentation and will be maintained there.
Tutorial that provides a brief introduction to Java Authentication and Authorization Service (JAAS) based on a dual module approach.
Magnolia CMS uses Java Authentication and Authorization Service. JAAS creates two distinct processes:
- Username and password request
- Authentication and authorization
Although it is possible to use other servlets, the default engine is Tomcat. Configuration is done in
The default configuration uses two classes:
- one for user login and password authentication, and
- one for authorization of user and password.
Each of these classes extends
The following (simplified) login procedure assumes you have two JAAS modules configured:
When a user logs in to Magnolia CMS, all configured JAAS modules try to authenticate the user by calling the login() method.
The method throws an
LoginExceptionif the login fails authentication. Since$webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources") AbstractLoginModuleprovides the
login()method, a JAAS module only has to implement a validateUser() method.
- After the user is successfully authenticated, the
commit()method of each JAAS module is called.
login() authentication method of
The second module's login authorization method is only called if the user has been properly verified. Therefore the login() authorization method of
commit() method includes the values from both authentication and authorization. The authentication module provides all user properties, while the authorization module adds the roles and groups and the respective ACLs to the user object.
Creating a new user class implementing
- First create a JAAS module extending: $webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources") JCRAuthorizationModule.
- Next, extend the following two methods:
Note that it is still necessary to implement the authentication method in order to properly create a User object.
Adding the JAAS module to the JAAS configuration
As Magnolia is to be the secondary user management method used, you have to use the following modifier: