Class JAASMemoryLoginModule

  • All Implemented Interfaces:
    javax.management.MBeanRegistration, javax.security.auth.spi.LoginModule, Contained, JmxEnabled, Lifecycle, Realm

    @Deprecated
    public class JAASMemoryLoginModule
    extends MemoryRealm
    implements javax.security.auth.spi.LoginModule
    Deprecated.
    This class will be removed in Tomcat 12.

    Implementation of the JAAS LoginModule interface, primarily for use in testing JAASRealm. It utilizes an XML-format data file of username/password/role information identical to that supported by org.apache.catalina.realm.MemoryRealm.

    This class recognizes the following string-valued options, which are specified in the configuration file and passed to initialize(Subject, CallbackHandler, Map, Map) in the options argument:

    • pathname - Relative (to the pathname specified by the "catalina.base" system property) or absolute pathname to the XML file containing our user information, in the format supported by MemoryRealm. The default value matches the MemoryRealm default.
    • credentialHandlerClassName - The fully qualified class name of the CredentialHandler to use. If not specified, MessageDigestCredentialHandler will be used.
    • Any additional options will be used to identify and call setters on the CredentialHandler. For example, algorithm=SHA256 would result in a call to MessageDigestCredentialHandler.setAlgorithm(String) with a parameter of "SHA256"

    IMPLEMENTATION NOTE - This class extends MemoryRealm rather than implementing Realm directly, so that user lookup and credential validation are performed against the XML file configured for the memory realm.

    • Field Detail

      • callbackHandler

        protected javax.security.auth.callback.CallbackHandler callbackHandler
        Deprecated.
        The callback handler responsible for answering our requests.
      • committed

        protected boolean committed
        Deprecated.
        Has our own commit() returned successfully?
      • options

        protected java.util.Map<java.lang.String,​?> options
        Deprecated.
        The configuration information for this LoginModule.
      • pathname

        protected java.lang.String pathname
        Deprecated.
        The absolute or relative pathname to the XML configuration file.
      • principal

        protected java.security.Principal principal
        Deprecated.
        The Principal identified by our validation, or null if validation failed.
      • roles

        protected java.util.HashSet<java.security.Principal> roles
        Deprecated.
        The Principal for the roles.
      • sharedState

        protected java.util.Map<java.lang.String,​?> sharedState
        Deprecated.
        The state information that is shared with other configured LoginModule instances.
      • subject

        protected javax.security.auth.Subject subject
        Deprecated.
        The subject for which we are performing authentication.
    • Constructor Detail

      • JAASMemoryLoginModule

        public JAASMemoryLoginModule()
        Deprecated.
        Constructs a new JAASMemoryLoginModule.
    • Method Detail

      • abort

        public boolean abort()
                      throws javax.security.auth.login.LoginException
        Deprecated.
        Specified by:
        abort in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • commit

        public boolean commit()
                       throws javax.security.auth.login.LoginException
        Deprecated.
        Specified by:
        commit in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • initialize

        public void initialize​(javax.security.auth.Subject subject,
                               javax.security.auth.callback.CallbackHandler callbackHandler,
                               java.util.Map<java.lang.String,​?> sharedState,
                               java.util.Map<java.lang.String,​?> options)
        Deprecated.
        Specified by:
        initialize in interface javax.security.auth.spi.LoginModule
      • login

        public boolean login()
                      throws javax.security.auth.login.LoginException
        Deprecated.
        Specified by:
        login in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • logout

        public boolean logout()
                       throws javax.security.auth.login.LoginException
        Deprecated.
        Specified by:
        logout in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • load

        protected void load()
        Deprecated.
        Load the contents of our configuration file.