Class SpringSecurityLoginModule

  • All Implemented Interfaces:
    LoginModule

    public class SpringSecurityLoginModule
    extends org.apache.jackrabbit.core.security.authentication.AbstractLoginModule
    A Jackrabbit LoginModule that delegates to a Spring Security AuthenticationManager. Also, adds more checks to the pre-authentication scenario.
    Author:
    mlowery
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.springframework.security.authentication.AuthenticationManager authManager  
      protected static org.springframework.security.authentication.AuthenticationManager NULL_AUTHENTICATION_MANAGER
      When there's no AuthenticationManager available in PentahoSystem, this one will be returned.
      • Fields inherited from class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule

        adminId, anonymousId, callbackHandler, credentials, principal, principalProvider, sharedState, subject
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doInit​(CallbackHandler callbackHandler, javax.jcr.Session session, Map options)
      protected org.apache.jackrabbit.core.security.authentication.Authentication getAuthentication​(Principal principal, javax.jcr.Credentials credentials)
      Creates a UsernamePasswordAuthenticationToken from the given principal and credentials and passes to Spring Security AuthenticationManager.
      protected org.springframework.security.authentication.AuthenticationManager getAuthenticationManager()  
      protected Principal getPrincipal​(javax.jcr.Credentials credentials)
      protected boolean impersonate​(Principal principal, javax.jcr.Credentials credentials)
      protected boolean isPreAuthenticated​(javax.jcr.Credentials creds)  
      • Methods inherited from class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule

        abort, authenticate, commit, getAdminId, getAnonymousId, getCredentials, getImpersonatorSubject, getPreAuthAttributeName, getPrincipalProvider, getPrincipals, getUserID, initialize, isAnonymous, isImpersonation, isInitialized, login, logout, setAdminId, setAnonymousId, setPrincipalProvider, supportsCredentials
    • Field Detail

      • NULL_AUTHENTICATION_MANAGER

        protected static final org.springframework.security.authentication.AuthenticationManager NULL_AUTHENTICATION_MANAGER
        When there's no AuthenticationManager available in PentahoSystem, this one will be returned. It's sole purpose is to throw an Exception whenever an Authentication attempt is made so a NPE doesn't occur.
      • authManager

        protected static org.springframework.security.authentication.AuthenticationManager authManager
    • Constructor Detail

      • SpringSecurityLoginModule

        public SpringSecurityLoginModule()
    • Method Detail

      • doInit

        protected void doInit​(CallbackHandler callbackHandler,
                              javax.jcr.Session session,
                              Map options)
                       throws LoginException
        Specified by:
        doInit in class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule
        Throws:
        LoginException
      • getAuthenticationManager

        protected org.springframework.security.authentication.AuthenticationManager getAuthenticationManager()
      • getAuthentication

        protected org.apache.jackrabbit.core.security.authentication.Authentication getAuthentication​(Principal principal,
                                                                                                      javax.jcr.Credentials credentials)
                                                                                               throws javax.jcr.RepositoryException
        Creates a UsernamePasswordAuthenticationToken from the given principal and credentials and passes to Spring Security AuthenticationManager.
        Specified by:
        getAuthentication in class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule
        Throws:
        javax.jcr.RepositoryException
      • getPrincipal

        protected Principal getPrincipal​(javax.jcr.Credentials credentials)

        Implementation copied from SimpleLoginModule. Delegates to a PrincipalProvider.

        Specified by:
        getPrincipal in class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule
      • impersonate

        protected boolean impersonate​(Principal principal,
                                      javax.jcr.Credentials credentials)
                               throws javax.jcr.RepositoryException,
                                      LoginException

        Not implemented.

        Specified by:
        impersonate in class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule
        Throws:
        javax.jcr.RepositoryException
        LoginException
      • isPreAuthenticated

        protected boolean isPreAuthenticated​(javax.jcr.Credentials creds)
        Overrides:
        isPreAuthenticated in class org.apache.jackrabbit.core.security.authentication.AbstractLoginModule