Class BaseAuthModule

  • All Implemented Interfaces:
    javax.security.auth.message.config.ServerAuthContext, javax.security.auth.message.module.ServerAuthModule, javax.security.auth.message.ServerAuth
    Direct Known Subclasses:
    BasicAuthenticationAuthModule

    public abstract class BaseAuthModule
    extends java.lang.Object
    implements javax.security.auth.message.module.ServerAuthModule, javax.security.auth.message.config.ServerAuthContext
    Simple abstract module implementing a Javax Authentication ServerAuthModule and ServerAuthContext. To be used as a building block for building more sophisticated auth modules.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.security.auth.callback.CallbackHandler callbackHandler  
      protected static java.lang.String LOGIN_SERVICE_KEY  
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseAuthModule()  
      BaseAuthModule​(javax.security.auth.callback.CallbackHandler callbackHandler)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanSubject​(javax.security.auth.message.MessageInfo messageInfo, javax.security.auth.Subject subject)  
      java.lang.Class[] getSupportedMessageTypes()  
      void initialize​(javax.security.auth.message.MessagePolicy requestPolicy, javax.security.auth.message.MessagePolicy responsePolicy, javax.security.auth.callback.CallbackHandler handler, java.util.Map options)  
      protected boolean isMandatory​(javax.security.auth.message.MessageInfo messageInfo)  
      protected boolean login​(javax.security.auth.Subject clientSubject, java.lang.String credentials, java.lang.String authMethod, javax.security.auth.message.MessageInfo messageInfo)  
      protected boolean login​(javax.security.auth.Subject clientSubject, java.lang.String username, Credential credential, java.lang.String authMethod, javax.security.auth.message.MessageInfo messageInfo)  
      javax.security.auth.message.AuthStatus secureResponse​(javax.security.auth.message.MessageInfo messageInfo, javax.security.auth.Subject serviceSubject)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.security.auth.message.ServerAuth

        validateRequest
    • Field Detail

      • LOGIN_SERVICE_KEY

        protected static final java.lang.String LOGIN_SERVICE_KEY
        See Also:
        Constant Field Values
      • callbackHandler

        protected javax.security.auth.callback.CallbackHandler callbackHandler
    • Constructor Detail

      • BaseAuthModule

        public BaseAuthModule()
      • BaseAuthModule

        public BaseAuthModule​(javax.security.auth.callback.CallbackHandler callbackHandler)
    • Method Detail

      • getSupportedMessageTypes

        public java.lang.Class[] getSupportedMessageTypes()
        Specified by:
        getSupportedMessageTypes in interface javax.security.auth.message.module.ServerAuthModule
      • initialize

        public void initialize​(javax.security.auth.message.MessagePolicy requestPolicy,
                               javax.security.auth.message.MessagePolicy responsePolicy,
                               javax.security.auth.callback.CallbackHandler handler,
                               java.util.Map options)
                        throws javax.security.auth.message.AuthException
        Specified by:
        initialize in interface javax.security.auth.message.module.ServerAuthModule
        Throws:
        javax.security.auth.message.AuthException
      • cleanSubject

        public void cleanSubject​(javax.security.auth.message.MessageInfo messageInfo,
                                 javax.security.auth.Subject subject)
                          throws javax.security.auth.message.AuthException
        Specified by:
        cleanSubject in interface javax.security.auth.message.ServerAuth
        Throws:
        javax.security.auth.message.AuthException
      • secureResponse

        public javax.security.auth.message.AuthStatus secureResponse​(javax.security.auth.message.MessageInfo messageInfo,
                                                                     javax.security.auth.Subject serviceSubject)
                                                              throws javax.security.auth.message.AuthException
        Specified by:
        secureResponse in interface javax.security.auth.message.ServerAuth
        Throws:
        javax.security.auth.message.AuthException
      • isMandatory

        protected boolean isMandatory​(javax.security.auth.message.MessageInfo messageInfo)
        Parameters:
        messageInfo - message info to examine for mandatory flag
        Returns:
        whether authentication is mandatory or optional
      • login

        protected boolean login​(javax.security.auth.Subject clientSubject,
                                java.lang.String credentials,
                                java.lang.String authMethod,
                                javax.security.auth.message.MessageInfo messageInfo)
                         throws java.io.IOException,
                                javax.security.auth.callback.UnsupportedCallbackException
        Throws:
        java.io.IOException
        javax.security.auth.callback.UnsupportedCallbackException
      • login

        protected boolean login​(javax.security.auth.Subject clientSubject,
                                java.lang.String username,
                                Credential credential,
                                java.lang.String authMethod,
                                javax.security.auth.message.MessageInfo messageInfo)
                         throws java.io.IOException,
                                javax.security.auth.callback.UnsupportedCallbackException
        Throws:
        java.io.IOException
        javax.security.auth.callback.UnsupportedCallbackException