|
Framework Serveur J2EE ACube V3.1.0 |
|
acube.framework.clavierVirtuel.realm
Classe JDBCRealm
java.lang.Object
org.apache.catalina.realm.RealmBase
acube.framework.clavierVirtuel.realm.JDBCRealm Interfaces à implémenter:
-
org.apache.catalina.Lifecycle, MBeanRegistration, org.apache.catalina.Realm
public class JDBCRealm
Implmentation of
Realm that works with any JDBC supported
database. See the JDBCRealm.howto for more details on how to set up
the database and for configuration options.
TODO - Support connection pooling (including
message format objects) so that authenticate()
does
not have to be synchronized and would fix the ugly connection
logic.
Author:
-
Craig R. McClanahan
-
Carson McDonald
-
Ignacio Ortega
Version:
-
$Revision: 1.1 $ $Date: 2007-03-26 08:14:20 $
Sommaire des Attributs |
|
connectionNameThe connection username to use when trying to connect to the
database. |
|
|
|
connectionURLThe connection URL to use when trying to connect to the
database. |
|
|
|
driverInstance of the JDBC Driver class we use as a connection
factory. |
|
|
protected static final String |
INFODescriptive information about this Realm implementation. |
protected static final String |
NAMEDescriptive information about this Realm implementation. |
private PreparedStatement |
|
private PreparedStatement |
preparedRolesThe PreparedStatement to use for identifying the roles for a
specified user. |
|
roleNameColThe column in the user role table that names a role |
protected static final org.apache.catalina.util.StringManager |
SMThe string manager for this package. |
|
userCredColThe column in the user table that holds the user's credintials |
|
userNameColThe column in the user table that holds the user's NAME |
|
userRoleTableThe table that holds the relation between user's and roles |
|
|
Attributs hérités de l'interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Sommaire des Constructeurs |
|
Sommaire des Méthodes |
|
authenticate(String username, String credentials){@inheritDoc} |
|
authenticate(Connection dbConnection, String username, String credentials)Return the Principal associated with the specified username and
credentials, if there is one; otherwise return
null . |
|
close(Connection dbConnection)Close the specified database connection. |
protected PreparedStatement |
credentials(Connection dbConnection, String username)Return a PreparedStatement configured to perform the SELECT
required to retrieve user credentials for the specified
username. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getRoleNameCol()Return the column in the user role table that names a role. |
|
getRoles(String username)Return the roles associated with the gven user NAME. |
|
getUserCredCol()Return the column in the user table that holds the user's
credentials. |
|
getUserNameCol()Return the column in the user table that holds the user's NAME. |
|
getUserRoleTable()Return the table that holds the relation between user's and
roles. |
|
|
|
open()Open (if necessary) and return a database connection for use by
this Realm. |
|
release(Connection dbConnection)Release our use of this connection so that it can be recycled. |
protected PreparedStatement |
roles(Connection dbConnection, String username)Return a PreparedStatement configured to perform the SELECT
required to retrieve user roles for the specified username. |
|
setConnectionName(String connectionName)Set the username to use to connect to the database. |
|
|
|
setConnectionURL(String connectionURL)Set the URL to use to connect to the database. |
|
setDriverName(String driverName)Set the JDBC driver that will be used. |
|
setRoleNameCol(String roleNameCol)Set the column in the user role table that names a role. |
|
setUserCredCol(String userCredCol)Set the column in the user table that holds the user's
credentials. |
|
setUserNameCol(String userNameCol)Set the column in the user table that holds the user's NAME. |
|
setUserRoleTable(String userRoleTable)Set the table that holds the relation between user's and roles. |
|
setUserTable(String userTable)Set the table that holds user data. |
|
start()Prepare for active use of the public methods of this Component. |
|
stop()Gracefully shut down active use of the public methods of this
Component. |
Méthodes héritées de la classe org.apache.catalina.realm.RealmBase |
addLifecycleListener, addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, backgroundProcess, destroy, Digest, findLifecycleListeners, findSecurityConstraints, getAllRolesMode, getContainer, getController, getDigest, getDigestEncoding, getDomain, getInfo, getObjectName, getType, getValidate, hasResourcePermission, hasRole, hasUserDataPermission, init, main, postDeregister, postRegister, preDeregister, preRegister, removeLifecycleListener, removePropertyChangeListener, setAllRolesMode, setContainer, setController, setDigest, setDigestEncoding, setValidate, start, stop |
Méthodes héritées de la classe java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Méthodes héritées de l'interface org.apache.catalina.Lifecycle |
addLifecycleListener, findLifecycleListeners, removeLifecycleListener, start, stop |
Méthodes héritées de l'interface org.apache.catalina.Realm |
addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, backgroundProcess, findSecurityConstraints, getContainer, getInfo, hasResourcePermission, hasRole, hasUserDataPermission, removePropertyChangeListener, setContainer |
Méthodes héritées de l'interface javax.management.MBeanRegistration |
postDeregister, postRegister, preDeregister, preRegister |
Détail des Attributs
SM
protected static final org.apache.catalina.util.StringManager SM
-
The string manager for this package.
INFO
protected static final String INFO
-
Descriptive information about this Realm implementation.
NAME
protected static final String NAME
-
Descriptive information about this Realm implementation.
connectionName
private String connectionName
-
The connection username to use when trying to connect to the
database.
connectionPassword
private String connectionPassword
-
The connection URL to use when trying to connect to the
database.
connectionURL
private String connectionURL
-
The connection URL to use when trying to connect to the
database.
dbConnection
private Connection dbConnection
-
The connection to the database.
driver
private Driver driver
-
Instance of the JDBC Driver class we use as a connection
factory.
driverName
private String driverName
-
The JDBC driver to use.
preparedCredentials
private PreparedStatement preparedCredentials
-
The PreparedStatement to use for authenticating users.
preparedRoles
private PreparedStatement preparedRoles
-
The PreparedStatement to use for identifying the roles for a
specified user.
roleNameCol
private String roleNameCol
-
The column in the user role table that names a role
userCredCol
private String userCredCol
-
The column in the user table that holds the user's credintials
userNameCol
private String userNameCol
-
The column in the user table that holds the user's NAME
userRoleTable
private String userRoleTable
-
The table that holds the relation between user's and roles
userTable
private String userTable
-
The table that holds user data.
Détail des Constructeurs
JDBCRealm
public JDBCRealm()
Détail des méthodes
getConnectionName
public String getConnectionName()
-
Return the username to use to connect to the database.
Retours:
-
the username to use to connect to the database.
setConnectionName
public void setConnectionName(String connectionName)
-
Set the username to use to connect to the database.
Paramètres:
-
connectionName - Username
getConnectionPassword
public String getConnectionPassword()
-
Return the password to use to connect to the database.
Retours:
-
the password to use to connect to the database.
setConnectionPassword
public void setConnectionPassword(String connectionPassword)
-
Set the password to use to connect to the database.
Paramètres:
-
connectionPassword - User password
getConnectionURL
public String getConnectionURL()
-
Return the URL to use to connect to the database.
Retours:
-
the URL to use to connect to the database.
setConnectionURL
public void setConnectionURL(String connectionURL)
-
Set the URL to use to connect to the database.
Paramètres:
-
connectionURL - The new connection URL
getDriverName
public String getDriverName()
-
Return the JDBC driver that will be used.
Retours:
-
the JDBC driver that will be used.
setDriverName
public void setDriverName(String driverName)
-
Set the JDBC driver that will be used.
Paramètres:
-
driverName - The driver NAME
getRoleNameCol
public String getRoleNameCol()
-
Return the column in the user role table that names a role.
Retours:
-
the column in the user role table that names a role.
setRoleNameCol
public void setRoleNameCol(String roleNameCol)
-
Set the column in the user role table that names a role.
Paramètres:
-
roleNameCol - The column NAME
getUserCredCol
public String getUserCredCol()
-
Return the column in the user table that holds the user's
credentials.
Retours:
-
the column in the user table that holds the user's
credentials.
setUserCredCol
public void setUserCredCol(String userCredCol)
-
Set the column in the user table that holds the user's
credentials.
Paramètres:
-
userCredCol - The column NAME
getUserNameCol
public String getUserNameCol()
-
Return the column in the user table that holds the user's NAME.
Retours:
-
the column in the user table that holds the user's
NAME.
setUserNameCol
public void setUserNameCol(String userNameCol)
-
Set the column in the user table that holds the user's NAME.
Paramètres:
-
userNameCol - The column NAME
getUserRoleTable
public String getUserRoleTable()
-
Return the table that holds the relation between user's and
roles.
Retours:
-
the table that holds the relation between user's and
roles.
setUserRoleTable
public void setUserRoleTable(String userRoleTable)
-
Set the table that holds the relation between user's and roles.
Paramètres:
-
userRoleTable - The table NAME
getUserTable
public String getUserTable()
-
Return the table that holds user data..
Retours:
-
the table that holds user data..
setUserTable
public void setUserTable(String userTable)
-
Set the table that holds user data.
Paramètres:
-
userTable - The table NAME
authenticate
public synchronized Principal authenticate(String username,
String credentials)
-
{@inheritDoc}
Spécifié par:
-
authenticate in interface org.apache.catalina.Realm
Dépacées:
-
authenticate
public synchronized Principal authenticate(Connection dbConnection,
String username,
String credentials)
-
Return the Principal associated with the specified username and
credentials, if there is one; otherwise return
null
.
Paramètres:
-
dbConnection - The database connection to be used
-
username - Username of the Principal to look up
-
credentials - Password or other credentials to use in
authenticating this username
Retours:
-
the Principal associated with the specified username
and credentials
close
protected void close(Connection dbConnection)
-
Close the specified database connection.
Paramètres:
-
dbConnection - The connection to be closed
credentials
protected PreparedStatement credentials(Connection dbConnection,
String username)
throws SQLException
-
Return a PreparedStatement configured to perform the SELECT
required to retrieve user credentials for the specified
username.
Paramètres:
-
dbConnection - The database connection to be used
-
username - Username for which credentials should be retrieved
Retours:
-
a PreparedStatement configured
Exceptions:
-
SQLException - if a database error occurs
getName
protected String getName()
-
{@inheritDoc}
Dépacées:
-
getName in class org.apache.catalina.realm.RealmBase
getPassword
protected String getPassword(String username)
-
{@inheritDoc}
Dépacées:
-
getPassword in class org.apache.catalina.realm.RealmBase
getPrincipal
protected Principal getPrincipal(String username)
-
{@inheritDoc}
Dépacées:
-
getPrincipal in class org.apache.catalina.realm.RealmBase
getRoles
protected ArrayList getRoles(String username)
-
Return the roles associated with the gven user NAME.
-
Retours:
-
the roles associated with the gven user NAME.
open
protected Connection open()
throws SQLException
-
Open (if necessary) and return a database connection for use by
this Realm.
Retours:
-
a database connection
Exceptions:
-
SQLException - if a database error occurs
roles
protected PreparedStatement roles(Connection dbConnection,
String username)
throws SQLException
-
Return a PreparedStatement configured to perform the SELECT
required to retrieve user roles for the specified username.
Paramètres:
-
dbConnection - The database connection to be used
-
username - Username for which roles should be retrieved
Retours:
-
a PreparedStatement configured
Exceptions:
-
SQLException - if a database error occurs
start
public void start()
throws org.apache.catalina.LifecycleException
-
Prepare for active use of the public methods of this Component.
Spécifié par:
-
start in interface org.apache.catalina.Lifecycle
Dépacées:
-
start in class org.apache.catalina.realm.RealmBase
-
Exceptions:
-
org.apache.catalina.LifecycleException - if this component detects a fatal error that
prevents it from being started
release
protected void release(Connection dbConnection)
-
Release our use of this connection so that it can be recycled.
Paramètres:
-
dbConnection - The connection to be released
stop
public void stop()
throws org.apache.catalina.LifecycleException
-
Gracefully shut down active use of the public methods of this
Component.
Spécifié par:
-
stop in interface org.apache.catalina.Lifecycle
Dépacées:
-
stop in class org.apache.catalina.realm.RealmBase
-
Exceptions:
-
org.apache.catalina.LifecycleException - if this component detects a fatal error that
needs to be reported
|
Framework Serveur J2EE ACube V3.1.0 |
|
Version 3.1.0 du 06/11/2009 / Etat : Validé |
Cette création est mise à disposition selon le Contrat Paternité - Pas d'Utilisation Commerciale - Partage des Conditions Initiales à l'Identique disponible en ligne http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ ou par courrier postal à Creative Commons, 559 Nathan Abbott Way, Stanford,California 94305, USA.
|
|