Class AbstractJaasAuthenticationProvider

    • Field Detail

      • log

        protected final org.apache.commons.logging.Log log
    • Constructor Detail

      • AbstractJaasAuthenticationProvider

        public AbstractJaasAuthenticationProvider()
    • Method Detail

      • authenticate

        public Authentication authenticate​(Authentication auth)
                                    throws AuthenticationException
        Attempts to login the user given the Authentication objects principal and credential
        Specified by:
        authenticate in interface AuthenticationProvider
        Parameters:
        auth - The Authentication object to be authenticated.
        Returns:
        The authenticated Authentication object, with it's grantedAuthorities set.
        Throws:
        AuthenticationException - This implementation does not handle 'locked' or 'disabled' accounts. This method only throws a AuthenticationServiceException, with the message of the LoginException that will be thrown, should the loginContext.login() method fail.
      • createLoginContext

        protected abstract javax.security.auth.login.LoginContext createLoginContext​(javax.security.auth.callback.CallbackHandler handler)
                                                                              throws javax.security.auth.login.LoginException
        Creates the LoginContext to be used for authentication.
        Parameters:
        handler - The CallbackHandler that should be used for the LoginContext (never null).
        Returns:
        the LoginContext to use for authentication.
        Throws:
        javax.security.auth.login.LoginException
      • handleLogout

        protected void handleLogout​(SessionDestroyedEvent event)
        Handles the logout by getting the security contexts for the destroyed session and invoking LoginContext.logout() for any which contain a JaasAuthenticationToken.
        Parameters:
        event - the session event which contains the current session
      • setAuthorityGranters

        public void setAuthorityGranters​(AuthorityGranter[] authorityGranters)
        Set the AuthorityGranters that should be consulted for role names to be granted to the Authentication.
        Parameters:
        authorityGranters - AuthorityGranter array
        See Also:
        JaasAuthenticationProvider
      • setCallbackHandlers

        public void setCallbackHandlers​(JaasAuthenticationCallbackHandler[] callbackHandlers)
        Set the JAASAuthentcationCallbackHandler array to handle callback objects generated by the LoginContext.login method.
        Parameters:
        callbackHandlers - Array of JAASAuthenticationCallbackHandlers
      • setLoginContextName

        public void setLoginContextName​(java.lang.String loginContextName)
        Set the loginContextName, this name is used as the index to the configuration specified in the loginConfig property.
        Parameters:
        loginContextName -
      • setLoginExceptionResolver

        public void setLoginExceptionResolver​(LoginExceptionResolver loginExceptionResolver)
      • supports

        public boolean supports​(java.lang.Class<?> aClass)
        Description copied from interface: AuthenticationProvider
        Returns true if this AuthenticationProvider supports the indicated Authentication object.

        Returning true does not guarantee an AuthenticationProvider will be able to authenticate the presented instance of the Authentication class. It simply indicates it can support closer evaluation of it. An AuthenticationProvider can still return null from the AuthenticationProvider.authenticate(Authentication) method to indicate another AuthenticationProvider should be tried.

        Selection of an AuthenticationProvider capable of performing authentication is conducted at runtime the ProviderManager.

        Specified by:
        supports in interface AuthenticationProvider
        Returns:
        true if the implementation can more closely evaluate the Authentication class presented
      • setApplicationEventPublisher

        public void setApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
        Specified by:
        setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
      • getApplicationEventPublisher

        protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()