Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » realm » [javadoc | source]
org.apache.catalina.realm
public class: DataSourceRealm [javadoc | source]
java.lang.Object
   org.apache.catalina.realm.RealmBase
      org.apache.catalina.realm.DataSourceRealm

All Implemented Interfaces:
    Realm, MBeanRegistration, Lifecycle

Implmentation of Realm that works with any JDBC JNDI DataSource. See the JDBCRealm.howto for more details on how to set up the database and for configuration options.
Field Summary
protected  String dataSourceName    The name of the JNDI JDBC DataSource 
protected static final  String info    Descriptive information about this Realm implementation. 
protected  boolean localDataSource    Context local datasource. 
protected static final  String name    Descriptive information about this Realm implementation. 
protected  String roleNameCol    The column in the user role table that names a role 
protected static final  StringManager sm    The string manager for this package. 
protected  String userCredCol    The column in the user table that holds the user's credintials 
protected  String userNameCol    The column in the user table that holds the user's name 
protected  String userRoleTable    The table that holds the relation between user's and roles 
protected  String userTable    The table that holds user data. 
Fields inherited from org.apache.catalina.realm.RealmBase:
container,  containerLog,  digest,  digestEncoding,  info,  lifecycle,  md,  md5Encoder,  md5Helper,  sm,  started,  support,  validate,  allRolesMode,  type,  domain,  host,  path,  oname,  controller,  mserver,  initialized
Method from org.apache.catalina.realm.DataSourceRealm Summary:
authenticate,   authenticate,   close,   getDataSourceName,   getLocalDataSource,   getName,   getPassword,   getPassword,   getPrincipal,   getRoleNameCol,   getRoles,   getRoles,   getUserCredCol,   getUserNameCol,   getUserRoleTable,   getUserTable,   open,   setDataSourceName,   setLocalDataSource,   setRoleNameCol,   setUserCredCol,   setUserNameCol,   setUserRoleTable,   setUserTable,   start,   stop
Methods from org.apache.catalina.realm.RealmBase:
Digest,   addLifecycleListener,   addPropertyChangeListener,   authenticate,   authenticate,   authenticate,   authenticate,   backgroundProcess,   destroy,   digest,   findLifecycleListeners,   findSecurityConstraints,   getAllRolesMode,   getContainer,   getController,   getDigest,   getDigest,   getDigestEncoding,   getDomain,   getInfo,   getName,   getObjectName,   getPassword,   getPrincipal,   getPrincipal,   getType,   getValidate,   hasMessageDigest,   hasResourcePermission,   hasRole,   hasUserDataPermission,   init,   main,   postDeregister,   postRegister,   preDeregister,   preRegister,   removeLifecycleListener,   removePropertyChangeListener,   setAllRolesMode,   setContainer,   setController,   setDigest,   setDigestEncoding,   setValidate,   start,   stop
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.realm.DataSourceRealm Detail:
 public Principal authenticate(String username,
    String credentials) 
    Return the Principal associated with the specified username and credentials, if there is one; otherwise return 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.
 protected Principal authenticate(Connection dbConnection,
    String username,
    String credentials) throws SQLException 
    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.
 public String getDataSourceName() 
    Return the name of the JNDI JDBC DataSource.
 public 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(String username) 
    Return the password associated with the given principal's user name.
 protected String getPassword(Connection dbConnection,
    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.
 public 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 given user name.
 protected ArrayList getRoles(Connection dbConnection,
    String username) 
    Return the roles associated with the given user name
 public String getUserCredCol() 
    Return the column in the user table that holds the user's credentials.
 public String getUserNameCol() 
    Return the column in the user table that holds the user's name.
 public String getUserRoleTable() 
    Return the table that holds the relation between user's and roles.
 public String getUserTable() 
    Return the table that holds user data..
 protected Connection open() 
    Open the specified database connection.
 public  void setDataSourceName(String dataSourceName) 
    Set the name of the JNDI JDBC DataSource.
 public  void setLocalDataSource(boolean localDataSource) 
    Set to true to cause the datasource to be looked up in the webapp JNDI Context.
 public  void setRoleNameCol(String roleNameCol) 
    Set the column in the user role table that names a role.
 public  void setUserCredCol(String userCredCol) 
    Set the column in the user table that holds the user's credentials.
 public  void setUserNameCol(String userNameCol) 
    Set the column in the user table that holds the user's name.
 public  void setUserRoleTable(String userRoleTable) 
    Set the table that holds the relation between user's and roles.
 public  void setUserTable(String userTable) 
    Set the table that holds user data.
 public  void start() throws LifecycleException 
    Prepare for active use of the public methods of this Component.
 public  void stop() throws LifecycleException 
    Gracefully shut down active use of the public methods of this Component.