@Deprecated public class JDBCRealm extends RealmBase
For a Realm implementation that supports connection pooling and
doesn't require synchronisation of authenticate()
,
getPassword()
, roles()
and
getPrincipal()
or the ugly connection logic use the
DataSourceRealm
.
RealmBase.AllRolesMode
Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected String |
connectionName
Deprecated.
The connection username to use when trying to connect to the database.
|
protected String |
connectionPassword
Deprecated.
The connection URL to use when trying to connect to the database.
|
protected String |
connectionURL
Deprecated.
The connection URL to use when trying to connect to the database.
|
protected Connection |
dbConnection
Deprecated.
The connection to the database.
|
protected Driver |
driver
Deprecated.
Instance of the JDBC Driver class we use as a connection factory.
|
protected String |
driverName
Deprecated.
The JDBC driver to use.
|
protected static String |
info
Deprecated.
Descriptive information about this Realm implementation.
|
protected static String |
name
Deprecated.
Descriptive information about this Realm implementation.
|
protected PreparedStatement |
preparedCredentials
Deprecated.
The PreparedStatement to use for authenticating users.
|
protected PreparedStatement |
preparedRoles
Deprecated.
The PreparedStatement to use for identifying the roles for
a specified user.
|
protected String |
roleNameCol
Deprecated.
The column in the user role table that names a role
|
protected String |
userCredCol
Deprecated.
The column in the user table that holds the user's credentials
|
protected String |
userNameCol
Deprecated.
The column in the user table that holds the user's name
|
protected String |
userRoleTable
Deprecated.
The table that holds the relation between user's and roles
|
protected String |
userTable
Deprecated.
The table that holds user data.
|
allRolesMode, container, containerLog, digest, digestEncoding, md, md5Encoder, md5Helper, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassName
mserver
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
JDBCRealm()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Principal |
authenticate(Connection dbConnection,
String username,
String credentials)
Deprecated.
Return the Principal associated with the specified username and
credentials, if there is one; otherwise return
null . |
Principal |
authenticate(String username,
String credentials)
Deprecated.
Return the Principal associated with the specified username and
credentials, if there is one; otherwise return
null . |
protected void |
close(Connection dbConnection)
Deprecated.
Close the specified database connection.
|
protected PreparedStatement |
credentials(Connection dbConnection,
String username)
Deprecated.
Return a PreparedStatement configured to perform the SELECT required
to retrieve user credentials for the specified username.
|
String |
getConnectionName()
Deprecated.
Return the username to use to connect to the database.
|
String |
getConnectionPassword()
Deprecated.
Return the password to use to connect to the database.
|
String |
getConnectionURL()
Deprecated.
Return the URL to use to connect to the database.
|
String |
getDriverName()
Deprecated.
Return the JDBC driver that will be used.
|
String |
getInfo()
Deprecated.
Return descriptive information about this Realm implementation and
the corresponding version number, in the format
<description>/<version> . |
protected String |
getName()
Deprecated.
Return a short name for this Realm implementation.
|
protected String |
getPassword(String username)
Deprecated.
Return the password associated with the given principal's user name.
|
protected Principal |
getPrincipal(String username)
Deprecated.
Return the Principal associated with the given user name.
|
String |
getRoleNameCol()
Deprecated.
Return the column in the user role table that names a role.
|
protected ArrayList<String> |
getRoles(String username)
Deprecated.
Return the roles associated with the gven user name.
|
String |
getUserCredCol()
Deprecated.
Return the column in the user table that holds the user's credentials.
|
String |
getUserNameCol()
Deprecated.
Return the column in the user table that holds the user's name.
|
String |
getUserRoleTable()
Deprecated.
Return the table that holds the relation between user's and roles.
|
String |
getUserTable()
Deprecated.
Return the table that holds user data..
|
protected Connection |
open()
Deprecated.
Open (if necessary) and return a database connection for use by
this Realm.
|
protected void |
release(Connection dbConnection)
Deprecated.
Unused
|
protected PreparedStatement |
roles(Connection dbConnection,
String username)
Deprecated.
Return a PreparedStatement configured to perform the SELECT required
to retrieve user roles for the specified username.
|
void |
setConnectionName(String connectionName)
Deprecated.
Set the username to use to connect to the database.
|
void |
setConnectionPassword(String connectionPassword)
Deprecated.
Set the password to use to connect to the database.
|
void |
setConnectionURL(String connectionURL)
Deprecated.
Set the URL to use to connect to the database.
|
void |
setDriverName(String driverName)
Deprecated.
Set the JDBC driver that will be used.
|
void |
setRoleNameCol(String roleNameCol)
Deprecated.
Set the column in the user role table that names a role.
|
void |
setUserCredCol(String userCredCol)
Deprecated.
Set the column in the user table that holds the user's credentials.
|
void |
setUserNameCol(String userNameCol)
Deprecated.
Set the column in the user table that holds the user's name.
|
void |
setUserRoleTable(String userRoleTable)
Deprecated.
Set the table that holds the relation between user's and roles.
|
void |
setUserTable(String userTable)
Deprecated.
Set the table that holds user data.
|
protected void |
startInternal()
Deprecated.
Prepare for the beginning of active use of the public methods of this
component and implement the requirements of
LifecycleBase.startInternal() . |
protected void |
stopInternal()
Deprecated.
Gracefully terminate the active use of the public methods of this
component and implement the requirements of
LifecycleBase.stopInternal() . |
addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, authenticate, backgroundProcess, compareCredentials, digest, Digest, findSecurityConstraints, getAllRolesMode, getContainer, getDigest, getDigest, getDigestCharset, getDigestEncoding, getDomainInternal, getObjectNameKeyProperties, getPrincipal, getPrincipal, getPrincipal, getRealmPath, getRealmSuffix, getServer, getTransportGuaranteeRedirectStatus, getValidate, getX509UsernameRetrieverClassName, hasMessageDigest, hasResourcePermission, hasRole, hasUserDataPermission, initInternal, isStripRealmForGss, main, removePropertyChangeListener, setAllRolesMode, setContainer, setDigest, setDigestEncoding, setRealmPath, setStripRealmForGss, setTransportGuaranteeRedirectStatus, setValidate, setX509UsernameRetrieverClassName, toString
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
protected String connectionName
protected String connectionPassword
protected String connectionURL
protected Connection dbConnection
protected Driver driver
protected String driverName
protected static final String info
protected static final String name
protected PreparedStatement preparedCredentials
protected PreparedStatement preparedRoles
protected String roleNameCol
protected String userCredCol
protected String userNameCol
protected String userRoleTable
protected String userTable
public String getConnectionName()
public void setConnectionName(String connectionName)
connectionName
- Usernamepublic String getConnectionPassword()
public void setConnectionPassword(String connectionPassword)
connectionPassword
- User passwordpublic String getConnectionURL()
public void setConnectionURL(String connectionURL)
connectionURL
- The new connection URLpublic String getDriverName()
public void setDriverName(String driverName)
driverName
- The driver namepublic String getRoleNameCol()
public void setRoleNameCol(String roleNameCol)
roleNameCol
- The column namepublic String getUserCredCol()
public void setUserCredCol(String userCredCol)
userCredCol
- The column namepublic String getUserNameCol()
public void setUserNameCol(String userNameCol)
userNameCol
- The column namepublic String getUserRoleTable()
public void setUserRoleTable(String userRoleTable)
userRoleTable
- The table namepublic String getUserTable()
public void setUserTable(String userTable)
userTable
- The table namepublic String getInfo()
<description>/<version>
.public Principal authenticate(String username, String credentials)
null
.
If there are any errors with the JDBC connection, executing
the query or anything we return null (don't authenticate). This
event is also logged, and the connection will be closed so that
a subsequent request will automatically re-open it.authenticate
in interface Realm
authenticate
in class RealmBase
username
- Username of the Principal to look upcredentials
- Password or other credentials to use in
authenticating this usernamenull
if there is none.public Principal authenticate(Connection dbConnection, String username, String credentials)
null
.dbConnection
- The database connection to be usedusername
- Username of the Principal to look upcredentials
- Password or other credentials to use in
authenticating this usernameprotected void close(Connection dbConnection)
dbConnection
- The connection to be closedprotected PreparedStatement credentials(Connection dbConnection, String username) throws SQLException
dbConnection
- The database connection to be usedusername
- Username for which credentials should be retrievedSQLException
- if a database error occursprotected String getName()
protected String getPassword(String username)
getPassword
in class RealmBase
protected Principal getPrincipal(String username)
getPrincipal
in class RealmBase
protected ArrayList<String> getRoles(String username)
protected Connection open() throws SQLException
SQLException
- if a database error occurs@Deprecated protected void release(Connection dbConnection)
dbConnection
- The connection to be releasedprotected PreparedStatement roles(Connection dbConnection, String username) throws SQLException
dbConnection
- The database connection to be usedusername
- Username for which roles should be retrievedSQLException
- if a database error occursprotected void startInternal() throws LifecycleException
LifecycleBase.startInternal()
.startInternal
in class RealmBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedprotected void stopInternal() throws LifecycleException
LifecycleBase.stopInternal()
.stopInternal
in class RealmBase
LifecycleException
- if this component detects a fatal error
that needs to be reportedCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.