Framework Serveur J2EE ACube V3.1.0
CLASSE PRECEDANTE CLASSE SUIVANTE
SOMMAIRE: ATTR CONSTR METH DETAIL: ATTR CONSTR METH

acube.framework.clavierVirtuel.realm
Classe JDBCRealm
java.lang.Object
  org.apache.catalina.realm.RealmBase
      acube.framework.clavierVirtuel.realm.RealmBaseAcube
          acube.framework.clavierVirtuel.realm.JDBCRealm
Interfaces à implémenter:
org.apache.catalina.Lifecycle, MBeanRegistration, org.apache.catalina.Realm

public class JDBCRealm
hérite de RealmBaseAcube
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
private String
connectionName
The connection username to use when trying to connect to the database.
private String
connectionPassword
The connection URL to use when trying to connect to the database.
private String
connectionURL
The connection URL to use when trying to connect to the database.
private Connection
dbConnection
The connection to the database.
private Driver
driver
Instance of the JDBC Driver class we use as a connection factory.
private String
driverName
The JDBC driver to use.
protected static final String
INFO
Descriptive information about this Realm implementation.
protected static final String
NAME
Descriptive information about this Realm implementation.
private PreparedStatement
preparedCredentials
The PreparedStatement to use for authenticating users.
private PreparedStatement
preparedRoles
The PreparedStatement to use for identifying the roles for a specified user.
private String
roleNameCol
The column in the user role table that names a role
protected static final org.apache.catalina.util.StringManager
SM
The string manager for this package.
private String
userCredCol
The column in the user table that holds the user's credintials
private String
userNameCol
The column in the user table that holds the user's NAME
private String
userRoleTable
The table that holds the relation between user's and roles
private String
userTable
The table that holds user data.
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
synchronized Principal
authenticate(String username, String credentials)
{@inheritDoc}
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.
protected void
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.
String
getConnectionName()
Return the username to use to connect to the database.
String
getConnectionPassword()
Return the password to use to connect to the database.
String
getConnectionURL()
Return the URL to use to connect to the database.
String
getDriverName()
Return the JDBC driver that will be used.
protected String
getName()
{@inheritDoc}
protected String
getPassword(String username)
{@inheritDoc}
protected Principal
getPrincipal(String username)
{@inheritDoc}
String
getRoleNameCol()
Return the column in the user role table that names a role.
protected ArrayList
getRoles(String username)
Return the roles associated with the gven user NAME.
String
getUserCredCol()
Return the column in the user table that holds the user's credentials.
String
getUserNameCol()
Return the column in the user table that holds the user's NAME.
String
getUserRoleTable()
Return the table that holds the relation between user's and roles.
String
getUserTable()
Return the table that holds user data..
protected Connection
open()
Open (if necessary) and return a database connection for use by this Realm.
protected void
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.
void
setConnectionName(String connectionName)
Set the username to use to connect to the database.
void
setConnectionPassword(String connectionPassword)
Set the password to use to connect to the database.
void
setConnectionURL(String connectionURL)
Set the URL to use to connect to the database.
void
setDriverName(String driverName)
Set the JDBC driver that will be used.
void
setRoleNameCol(String roleNameCol)
Set the column in the user role table that names a role.
void
setUserCredCol(String userCredCol)
Set the column in the user table that holds the user's credentials.
void
setUserNameCol(String userNameCol)
Set the column in the user table that holds the user's NAME.
void
setUserRoleTable(String userRoleTable)
Set the table that holds the relation between user's and roles.
void
setUserTable(String userTable)
Set the table that holds user data.
void
start()
Prepare for active use of the public methods of this Component.
void
stop()
Gracefully shut down active use of the public methods of this Component.
Méthodes héritées de la classe acube.framework.clavierVirtuel.realm.RealmBaseAcube
authenticate
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
CLASSE PRECEDANTE CLASSE SUIVANTE
SOMMAIRE: ATTR CONSTR METH DETAIL: ATTR CONSTR METH

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.
Documentation generated by DocFlex