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

All Implemented Interfaces:
    Realm, MBeanRegistration, Lifecycle

Direct Known Subclasses:
    DataSourceRealm, UserDatabaseRealm, JNDIRealm, JAASRealm, JDBCRealm, JAASMemoryLoginModule, MemoryRealm

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.
Nested Class Summary:
protected static class  RealmBase.AllRolesMode   
Field Summary
protected  Container container    The Container with which this Realm is associated. 
protected  Log containerLog    Container log 
protected  String digest    Digest algorithm used in storing passwords in a non-plaintext format. Valid values are those accepted for the algorithm name by the MessageDigest class, or null if no digesting should be performed. 
protected  String digestEncoding    The encoding charset for the digest. 
protected static final  String info    Descriptive information about this Realm implementation. 
protected  LifecycleSupport lifecycle    The lifecycle event support for this component. 
protected  MessageDigest md    The MessageDigest object for digesting user credentials (passwords). 
protected static final  MD5Encoder md5Encoder    The MD5 helper object for this class. 
protected static  MessageDigest md5Helper    MD5 message digest provider. 
protected static  StringManager sm    The string manager for this package. 
protected  boolean started    Has this component been started? 
protected  PropertyChangeSupport support    The property change support for this component. 
protected  boolean validate    Should we validate client certificate chains when they are presented? 
protected  RealmBase.AllRolesMode allRolesMode    The all role mode. 
protected  String type     
protected  String domain     
protected  String host     
protected  String path     
protected  ObjectName oname     
protected  ObjectName controller     
protected  MBeanServer mserver     
protected  boolean initialized     
Method from org.apache.catalina.realm.RealmBase Summary:
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.RealmBase Detail:
 public static final String Digest(String credentials,
    String algorithm,
    String encoding) 
    Digest password using the algorithm especificied and convert the result to a corresponding hex string. If exception, the plain credentials string is returned
 public  void addLifecycleListener(LifecycleListener listener) 
    Add a lifecycle event listener to this component.
 public  void addPropertyChangeListener(PropertyChangeListener listener) 
    Add a property change listener to this component.
 public Principal authenticate(X509Certificate[] certs) 
    Return the Principal associated with the specified chain of X509 client certificates. If there is none, return null.
 public Principal authenticate(String username,
    String credentials) 
    Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.
 public Principal authenticate(String username,
    byte[] credentials) 
    Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.
 public Principal authenticate(String username,
    String clientDigest,
    String nOnce,
    String nc,
    String cnonce,
    String qop,
    String realm,
    String md5a2) 
    Return the Principal associated with the specified username, which matches the digest calculated using the given parameters using the method described in RFC 2069; otherwise return null.
 public  void backgroundProcess() 
    Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.
 public  void destroy() 
 protected String digest(String credentials) 
    Digest the password using the specified algorithm and convert the result to a corresponding hexadecimal string. If exception, the plain credentials string is returned.
 public LifecycleListener[] findLifecycleListeners() 
    Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.
 public SecurityConstraint[] findSecurityConstraints(Request request,
    Context context) 
    Return the SecurityConstraints configured to guard the request URI for this request, or null if there is no such constraint.
 public String getAllRolesMode() 
    Return the all roles mode.
 public Container getContainer() 
    Return the Container with which this Realm has been associated.
 public ObjectName getController() 
 public String getDigest() 
    Return the digest algorithm used for storing credentials.
 protected String getDigest(String username,
    String realmName) 
    Return the digest associated with given principal's user name.
 public String getDigestEncoding() 
    Returns the digest encoding charset.
 public String getDomain() 
 public String getInfo() 
    Return descriptive information about this Realm implementation and the corresponding version number, in the format <description>/<version>.
 abstract protected String getName()
    Return a short name for this Realm implementation, for use in log messages.
 public ObjectName getObjectName() 
 abstract protected String getPassword(String username)
    Return the password associated with the given principal's user name.
 protected Principal getPrincipal(X509Certificate usercert) 
    Return the Principal associated with the given certificate.
 abstract protected Principal getPrincipal(String username)
    Return the Principal associated with the given user name.
 public String getType() 
 public boolean getValidate() 
    Return the "validate certificate chains" flag.
 protected boolean hasMessageDigest() 
 public boolean hasResourcePermission(Request request,
    Response response,
    SecurityConstraint[] constraints,
    Context context) throws IOException 
    Perform access control based on the specified authorization constraint. Return true if this constraint is satisfied and processing should continue, or false otherwise.
 public boolean hasRole(Principal principal,
    String role) 
    Return true if the specified Principal has the specified security role, within the context of this Realm; otherwise return false. This method can be overridden by Realm implementations, but the default is adequate when an instance of GenericPrincipal is used to represent authenticated Principals from this Realm.
 public boolean hasUserDataPermission(Request request,
    Response response,
    SecurityConstraint[] constraints) throws IOException 
    Enforce any user data constraint required by the security constraint guarding this request URI. Return true if this constraint was not violated and processing should continue, or false if we have created a response already.
 public  void init() 
 public static  void main(String[] args) 
    Digest password using the algorithm especificied and convert the result to a corresponding hex string. If exception, the plain credentials string is returned
 public  void postDeregister() 
 public  void postRegister(Boolean registrationDone) 
 public  void preDeregister() throws Exception 
 public ObjectName preRegister(MBeanServer server,
    ObjectName name) throws Exception 
 public  void removeLifecycleListener(LifecycleListener listener) 
    Remove a lifecycle event listener from this component.
 public  void removePropertyChangeListener(PropertyChangeListener listener) 
    Remove a property change listener from this component.
 public  void setAllRolesMode(String allRolesMode) 
    Set the all roles mode.
 public  void setContainer(Container container) 
    Set the Container with which this Realm has been associated.
 public  void setController(ObjectName controller) 
 public  void setDigest(String digest) 
    Set the digest algorithm used for storing credentials.
 public  void setDigestEncoding(String charset) 
    Sets the digest encoding charset.
 public  void setValidate(boolean validate) 
    Set the "validate certificate chains" flag.
 public  void start() throws LifecycleException 
    Prepare for the beginning of active use of the public methods of this component. This method should be called before any of the public methods of this component are utilized. It should also send a LifecycleEvent of type START_EVENT to any registered listeners.
 public  void stop() throws LifecycleException 
    Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component. It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.