public class DataSourceRealm extends RealmBase
RealmBase.AllRolesModeLifecycle.SingleUse| Modifier and Type | Field and Description | 
|---|---|
| protected String | dataSourceNameThe name of the JNDI JDBC DataSource | 
| protected static String | infoDescriptive information about this Realm implementation. | 
| protected boolean | localDataSourceContext local datasource. | 
| protected static String | nameDescriptive information about this Realm implementation. | 
| protected String | roleNameColThe column in the user role table that names a role | 
| protected String | userCredColThe column in the user table that holds the user's credentials | 
| protected String | userNameColThe column in the user table that holds the user's name | 
| protected String | userRoleTableThe table that holds the relation between user's and roles | 
| protected String | userTableThe table that holds user data. | 
allRolesMode, container, containerLog, digest, digestEncoding, md, md5Encoder, md5Helper, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassNamemserverAFTER_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 | 
|---|
| DataSourceRealm() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected 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. | 
| Principal | authenticate(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. | 
| String | getDataSourceName()Return the name of the JNDI JDBC DataSource. | 
| String | getInfo()Return descriptive information about this Realm implementation and
 the corresponding version number, in the format
  <description>/<version>. | 
| boolean | getLocalDataSource()Return if the datasource will be looked up in the webapp JNDI Context. | 
| protected String | getName()Return a short name for this Realm implementation. | 
| protected String | getPassword(Connection dbConnection,
           String username)Return the password associated with the given principal's user name. | 
| protected String | getPassword(String username)Return the password associated with the given principal's user name. | 
| protected Principal | getPrincipal(String username)Return the Principal associated with the given user name. | 
| String | getRoleNameCol()Return the column in the user role table that names a role. | 
| protected ArrayList<String> | getRoles(Connection dbConnection,
        String username)Return the roles associated with the given user name. | 
| protected ArrayList<String> | getRoles(String username)Return the roles associated with the given 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 the specified database connection. | 
| void | setDataSourceName(String dataSourceName)Set the name of the JNDI JDBC DataSource. | 
| void | setLocalDataSource(boolean localDataSource)Set to true to cause the datasource to be looked up in the webapp JNDI
 Context. | 
| 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. | 
| protected void | startInternal()Prepare for the beginning of active use of the public methods of this
 component and implement the requirements of
  LifecycleBase.startInternal(). | 
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, stopInternal, toStringdestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregisteraddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopprotected String dataSourceName
protected static final String info
protected boolean localDataSource
protected static final String name
protected String roleNameCol
protected String userCredCol
protected String userNameCol
protected String userRoleTable
protected String userTable
public String getDataSourceName()
public void setDataSourceName(String dataSourceName)
dataSourceName - the name of the JNDI JDBC DataSourcepublic boolean getLocalDataSource()
public void setLocalDataSource(boolean localDataSource)
localDataSource - the new flag valuepublic 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 Realmauthenticate in class RealmBaseusername - Username of the Principal to look upcredentials - Password or other credentials to use in
  authenticating this usernamenull if there is none.protected 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 Connection open()
protected String getName()
protected String getPassword(String username)
getPassword in class RealmBaseprotected String getPassword(Connection dbConnection, String username)
dbConnection - The database connection to be usedusername - Username for which password should be retrievedprotected Principal getPrincipal(String username)
getPrincipal in class RealmBaseprotected ArrayList<String> getRoles(String username)
username - Username for which roles should be retrievedprotected ArrayList<String> getRoles(Connection dbConnection, String username)
dbConnection - The database connection to be usedusername - User name for which roles should be retrievedprotected void startInternal()
                      throws LifecycleException
LifecycleBase.startInternal().startInternal in class RealmBaseLifecycleException - if this component detects a fatal error
  that prevents this component from being usedCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.