Package org.jdesktop.swingx.auth
Class JDBCLoginService
java.lang.Object
org.jdesktop.beans.AbstractBean
org.jdesktop.swingx.auth.LoginService
org.jdesktop.swingx.auth.JDBCLoginService
A login service for connecting to SQL based databases via JDBC
- Author:
- rbair
-
Constructor Summary
ConstructorsConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptionboolean
authenticate
(String name, char[] password, String server) This method is intended to be implemented by clients wishing to authenticate a user with a given password.getUrl()
void
setConnection
(Connection conn) void
setProperties
(Properties properties) void
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 Details
-
JDBCLoginService
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
driver
- DB driver class nameurl
- DB url
-
JDBCLoginService
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
driver
- DB driver class nameurl
- DB urlprops
- Properties
-
JDBCLoginService
Create a new JDBCLoginService and initializes it to connect to a database using the given params.- Parameters:
jndiContext
- String
-
JDBCLoginService
public JDBCLoginService()Default JavaBean constructor
-
-
Method Details
-
getUrl
- Returns:
- the JDBC connection url
-
setUrl
- Parameters:
url
- set the JDBC connection url
-
getProperties
- Returns:
- JDBC connection properties
-
setProperties
- Parameters:
properties
- miscellaneous JDBC properties to use when connecting to the database via the JDBC driver
-
getConnection
- Returns:
- Connection
-
setConnection
- Parameters:
conn
- Connection
-
authenticate
Description copied from class:LoginService
This 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:
authenticate
in 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:
true
on authentication success- Throws:
Exception
- TODO explain
-