Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 //
 //  ========================================================================
 //  Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
 //  and Apache License v2.0 which accompanies this distribution.
 //
 //      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//
package org.eclipse.jetty.jaas.spi;
DataSourceLoginModule A LoginModule that uses a DataSource to retrieve user authentication and authorisation information.

See also:
JDBCLoginModule
    private String dbJNDIName;
    private DataSource dataSource;
    /* ------------------------------------------------ */
    
Init LoginModule. Called once by JAAS after new instance created.

Parameters:
subject
callbackHandler
sharedState
options
    public void initialize(Subject subject,
                           CallbackHandler callbackHandler,
                           Map<String,?> sharedState,
                           Map<String,?> options)
    {
        try
        {
            super.initialize(subjectcallbackHandlersharedStateoptions);
            //get the datasource jndi name
             = (String)options.get("dbJNDIName");
            InitialContext ic = new InitialContext();
             = (DataSource)ic.lookup("java:comp/env/"+);
        }
        catch (NamingException e)
        {
            throw new IllegalStateException (e.toString());
        }
    }


    
Get a connection from the DataSource

Returns:
the connection for the datasource
Throws:
java.lang.Exception
See also:
AbstractDatabaseLoginModule.getConnection()
    public Connection getConnection ()
    throws Exception
    {
        return .getConnection();
    }
New to GrepCode? Check out our FAQ X