Package org.jdesktop.swingx.auth
Class JDBCLoginService
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.swingx.auth.LoginService
-
- org.jdesktop.swingx.auth.JDBCLoginService
-
public class JDBCLoginService extends LoginService
A login service for connecting to SQL based databases via JDBC- Author:
- rbair
-
-
Constructor Summary
Constructors Constructor Description JDBCLoginService()Default JavaBean constructorJDBCLoginService(String jndiContext)Create a new JDBCLoginService and initializes it to connect to a database using the given params.JDBCLoginService(String driver, String url)Create a new JDBCLoginService and initializes it to connect to a database using the given params.JDBCLoginService(String driver, String url, Properties props)Create a new JDBCLoginService and initializes it to connect to a database using the given params.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticate(String name, char[] password, String server)This method is intended to be implemented by clients wishing to authenticate a user with a given password.ConnectiongetConnection()PropertiesgetProperties()StringgetUrl()voidsetConnection(Connection conn)voidsetProperties(Properties properties)voidsetUrl(String url)-
Methods inherited from class org.jdesktop.swingx.auth.LoginService
addLoginListener, cancelAuthentication, getServer, getSynchronous, getUserRoles, removeLoginListener, setServer, setSynchronous, startAuthentication
-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
JDBCLoginService
public JDBCLoginService(String driver, String url)
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
driver-url-
-
JDBCLoginService
public JDBCLoginService(String driver, String url, Properties props)
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
driver-url-props-
-
JDBCLoginService
public JDBCLoginService(String jndiContext)
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
jndiContext-
-
JDBCLoginService
public JDBCLoginService()
Default JavaBean constructor
-
-
Method Detail
-
getUrl
public String getUrl()
- Returns:
- the JDBC connection url
-
setUrl
public void setUrl(String url)
- Parameters:
url- set the JDBC connection url
-
getProperties
public Properties getProperties()
- Returns:
- JDBC connection properties
-
setProperties
public void setProperties(Properties properties)
- Parameters:
properties- miscellaneous JDBC properties to use when connecting to the database via the JDBC driver
-
getConnection
public Connection getConnection()
-
setConnection
public void setConnection(Connection conn)
-
authenticate
public boolean authenticate(String name, char[] password, String server) throws Exception
Description copied from class:LoginServiceThis method is intended to be implemented by clients wishing to authenticate a user with a given password. Clients should implement the authentication in a manner that the authentication can be cancelled at any time.- Specified by:
authenticatein classLoginService- Parameters:
name- user namepassword- user passwordserver- Must be either a valid JDBC URL for the type of JDBC driver you are using, or must be a valid JNDIContext from which to get the database connection- Returns:
trueon authentication success- Throws:
Exception
-
-