|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.catalina.realm.RealmBase | +--org.apache.catalina.realm.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.
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.
Fields inherited from class org.apache.catalina.realm.RealmBase |
container, debug, info, lifecycle, md5Encoder, md5Helper, sm, started, support |
Fields inherited from interface org.apache.catalina.Lifecycle |
START_EVENT, STOP_EVENT |
Constructor Summary | |
MemoryRealm()
|
Method Summary | |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component. |
java.security.Principal |
authenticate(java.lang.String username,
byte[] credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null . |
java.security.Principal |
authenticate(java.lang.String username,
java.lang.String credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null . |
Container |
getContainer()
Return the Container with which this Realm has been associated. |
int |
getDebug()
Return the debugging detail level for this component. |
java.lang.String |
getInfo()
Return descriptive information about this Realm implementation and the corresponding version number, in the format <description>/<version> . |
protected java.lang.String |
getPassword(java.lang.String username)
Return the password associated with the given principal's user name. |
protected java.security.Principal |
getPrincipal(java.lang.String username)
Return the Principal associated with the given user name. |
boolean |
hasRole(java.security.Principal principal,
java.lang.String role)
Return true if the specified Principal has the specified
security role, within the context of this Realm; otherwise return
false . |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component. |
void |
setContainer(Container container)
Set the Container with which this Realm has been associated. |
void |
setDebug(int debug)
Set the debugging detail level for this component. |
void |
start()
Prepare for active use of the public methods of this Component. |
void |
stop()
Gracefully shut down active use of the public methods of this Component. |
Methods inherited from class org.apache.catalina.realm.RealmBase |
authenticate, getDigest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MemoryRealm()
Method Detail |
public Container getContainer()
getContainer
in class RealmBase
public void setContainer(Container container)
setContainer
in class RealmBase
container
- The associated Containerpublic int getDebug()
getDebug
in class RealmBase
public void setDebug(int debug)
setDebug
in class RealmBase
debug
- The new debugging detail levelpublic java.lang.String getInfo()
<description>/<version>
.getInfo
in class RealmBase
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in class RealmBase
listener
- The listener to addpublic java.security.Principal authenticate(java.lang.String username, java.lang.String credentials)
null
.authenticate
in class RealmBase
username
- Username of the Principal to look upcredentials
- Password or other credentials to use in
authenticating this usernamepublic java.security.Principal authenticate(java.lang.String username, byte[] credentials)
null
.authenticate
in class RealmBase
username
- Username of the Principal to look upcredentials
- Password or other credentials to use in
authenticating this usernamepublic boolean hasRole(java.security.Principal principal, java.lang.String role)
true
if the specified Principal has the specified
security role, within the context of this Realm; otherwise return
false
.hasRole
in class RealmBase
principal
- Principal for whom the role is to be checkedrole
- Security role to be checkedpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in class RealmBase
listener
- The listener to removeprotected java.lang.String getPassword(java.lang.String username)
getPassword
in class RealmBase
protected java.security.Principal getPrincipal(java.lang.String username)
getPrincipal
in class RealmBase
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in class RealmBase
listener
- The listener to addpublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in class RealmBase
listener
- The listener to removepublic void start() throws LifecycleException
start
in class RealmBase
IllegalStateException
- if this component has already been
startedLifecycleException
- if this component detects a fatal error
that prevents it from being startedpublic void stop() throws LifecycleException
stop
in class RealmBase
IllegalStateException
- if this component has not been startedLifecycleException
- if this component detects a fatal error
that needs to be reported
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |