Class JDBCLoginModule

  • All Implemented Interfaces:
    javax.security.auth.spi.LoginModule

    public class JDBCLoginModule
    extends AbstractDatabaseLoginModule

    JAAS LoginModule to retrieve user information from a database and authenticate the user.

    Notes

    This version uses plain old JDBC connections NOT DataSources.

    • Constructor Detail

      • JDBCLoginModule

        public JDBCLoginModule()
    • Method Detail

      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.lang.Exception
        Get a connection from the DriverManager
        Specified by:
        getConnection in class AbstractDatabaseLoginModule
        Returns:
        the connection for this datasource
        Throws:
        java.lang.Exception - if unable to get the connection
      • 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)
        Init LoginModule.

        Called once by JAAS after new instance created.

        Specified by:
        initialize in interface javax.security.auth.spi.LoginModule
        Overrides:
        initialize in class AbstractDatabaseLoginModule
        Parameters:
        subject - the subject
        callbackHandler - the callback handler
        sharedState - the shared state map
        options - the options map
        See Also:
        LoginModule.initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)