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

All Implemented Interfaces:
    Realm, MBeanRegistration, Lifecycle

Direct Known Subclasses:
    JAASMemoryLoginModule

Simple implementation of Realm that reads an XML file to configure the valid users, passwords, and roles. The file format (and default file location) are identical to those currently supported by Tomcat 3.X.

IMPLEMENTATION NOTE: It is assumed that the in-memory collection representing our defined users (and their roles) is initialized at application startup and never modified again. Therefore, no thread synchronization is performed around accesses to the principals collection.

Field Summary
protected final  String info    Descriptive information about this Realm implementation. 
protected static final  String name    Descriptive information about this Realm implementation. 
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.MemoryRealm Summary:
addUser,   authenticate,   getDigester,   getInfo,   getName,   getPassword,   getPathname,   getPrincipal,   getPrincipals,   setPathname,   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.MemoryRealm Detail:
  void addUser(String username,
    String password,
    String roles) 
    Add a new user to the in-memory database.
 public Principal authenticate(String username,
    String credentials) 
    Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.
 protected synchronized Digester getDigester() 
    Return a configured Digester to use for processing the XML input file, creating a new one if necessary.
 public String getInfo() 
    Return descriptive information about this Realm implementation and the corresponding version number, in the format <description>/<version>.
 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.
 public String getPathname() 
    Return the pathname of our XML file containing user definitions.
 protected Principal getPrincipal(String username) 
    Return the Principal associated with the given user name.
 protected Map getPrincipals() 
    Returns the principals for this realm.
 public  void setPathname(String pathname) 
    Set the pathname of our XML file containing user definitions. If a relative pathname is specified, it is resolved against "catalina.base".
 public synchronized  void start() throws LifecycleException 
    Prepare for active use of the public methods of this Component.
 public synchronized  void stop() throws LifecycleException 
    Gracefully shut down active use of the public methods of this Component.