Class AbstractDatabaseLoginModule

  • All Implemented Interfaces:
    javax.security.auth.spi.LoginModule
    Direct Known Subclasses:
    DataSourceLoginModule, JDBCLoginModule

    public abstract class AbstractDatabaseLoginModule
    extends AbstractLoginModule
    AbstractDatabaseLoginModule Abstract base class for LoginModules that interact with a database to retrieve authentication and authorization information. Used by the JDBCLoginModule and DataSourceLoginModule.
    • Constructor Detail

      • AbstractDatabaseLoginModule

        public AbstractDatabaseLoginModule()
    • Method Detail

      • getConnection

        public abstract java.sql.Connection getConnection()
                                                   throws java.lang.Exception
        Returns:
        a java.sql.Connection from the database
        Throws:
        java.lang.Exception - if unable to get the connection
      • getUserInfo

        public UserInfo getUserInfo​(java.lang.String userName)
                             throws java.lang.Exception
        Load info from database
        Specified by:
        getUserInfo in class AbstractLoginModule
        Parameters:
        userName - user info to load
        Throws:
        java.lang.Exception - if unable to get the user info
      • getRoles

        public java.util.List<java.lang.String> getRoles​(java.lang.String userName)
                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • 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)
        Specified by:
        initialize in interface javax.security.auth.spi.LoginModule
        Overrides:
        initialize in class AbstractLoginModule
        Parameters:
        subject - the subject
        callbackHandler - the callback handler
        sharedState - the shared state map
        options - the option map
        See Also:
        LoginModule.initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)