Example { org.apache.jackrabbit.oak.security.authentication.token.TokenLoginModule sufficient; org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl sufficient; org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModule required sync.handlerName="your-synchandler_name" idp.name="your_idp_name"; };
The TokenLoginModule is in charge of handling repository authentication request with TokenCredentials:
NOTE: In this setup the TokenLoginModule is expected to only handle subsequent authentication request after having issued a login token. The latter is achieved by providing Credentials attributes that force the TokenLoginModule to generate a new login token in the commit phase. The application should then use that login toke for subsequent requests.
See Token Authentication and Token Management for details and for a description of the default implementation.
The LoginModuleImpl is in charge of handling authentication request for users managed and created through the repository’s user management API; i.e. users that are not defined by an ExternalIdentityProvider. This includes built-in system users like the administrator, the guest-user (aka anonymous) or SystemUsers. It also handles impersonation logins.
NOTE: if no login token is generated upon first login, any subsequent login for local users will end up being handled by this module or fail.
The ExternalLoginModule is in charge of handling authentication request for users managed by an ExternalIdentityProvider.
NOTE: if no login token is generated upon first login, any subsequent login for external users will end up being handled by this module (including connection to the IDP) or fail.
Example { your.org.PreAuthenticationLoginModule optional; org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl optional; org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModule sufficient sync.handlerName="your-synchandler_name" idp.name="your_idp_name"; };
See Pre-Authenticated Login for an example LoginModule that illustrates how the pre-authentication is being pushed to the shared stated.
Note: This configuration has been slightly adjusted from the example in OAK-3508 marking the pre-auth login to be optional. This highlights the fact that subsequent LoginModules are in charge of respecting the PreAuthenticatedLogin marker and properly populating the Subject in the second commit phase.
Also, in the example implementation the login never succeeds (in which case sufficient would actually work as well). However, if it ever succeeded the PreAuthenticatedLogin marker would be meaningless and the pre-auth module in fact would have to populate the Subject i.e. relying on details defined and handled by other LoginModules.
The custom pre-auth module is in charge of handling custom pre-auth Credentials shared between the code performing the authentication outside of the scope of the repository and this module. It’s only task is to create the PreAuthenticatedLogin marker and push it to the shared stated to inform subsequent modules, which will always be consulted due to the optional flag.
The LoginModuleImpl will try to resolve the repository user associated with the PreAuthenticatedLogin or perform regular login with the login Credentials if no PreAuthenticatedLogin is present.
The ExternalLoginModule will try to resolve the PreAuthenticatedLogin or alternatively the Credentials to a SyncedIdentity.
The custom Credentials shared between the code performing the authentication (outside of the repository) and the custom PreAuthenticationLoginModule implementation must neither be public nor shared with other implementations in order to prevent un-authenticated login.
If LoginModuleImpl was defined to be sufficient external identities would never be synced again if the PreAuthenticatedLogin marker is present in the shared state.
If ExternalLoginModule was required to succeed, login for local users was no longer possible. It also would mean that pre-authenticated login for a SyncedIdentity that doesn’t needs a re-sync would not longer be possible and would ultimately fail the repository authentication.