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.
| Modifier and Type | Field and Description |
|---|---|
| private final Map | credentials
The set of credentials for this Realm, keyed by user name. |
| private static Digester | digester
The Digester we will use to process in-memory database files. |
| private static final Object | |
| private static final Log | |
| private String | pathname
The pathname (absolute or relative to Catalina's current working directory) of the XML file containing our database information. |
| private final Map | principals
The set of valid Principals for this Realm, keyed by user name. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public Principal | authenticate(String
Username of the Principal to look up username, String Password or other credentials to use in
authenticating this username credentials)Overrides org. Implements org. Try to authenticate using the specified username and credentials. |
| protected Digester | Returns: a configuredDigester to use for processing the XML input file, creating a new one if
necessary.
|
| protected String | getPassword(String
The user name username)Implements abstract org. Get the password for the specified user. |
| public String | |
| protected Principal | getPrincipal(String
The user name username)Implements abstract org. Get the principal associated with the specified user. |
| public void | setPathname(String
The new pathname pathname)Set the pathname of our XML file containing user definitions. |
| protected void | startInternal()
Overrides org. Prepare for the beginning of active use of the public methods of this component and implement the requirements of
|
| credentials | back to summary |
|---|---|
| private final Map<String, String> credentials The set of credentials for this Realm, keyed by user name. | |
| digester | back to summary |
|---|---|
| private static Digester digester The Digester we will use to process in-memory database files. | |
| digesterLock | back to summary |
|---|---|
| private static final Object digesterLock | |
| log | back to summary |
|---|---|
| private static final Log log | |
| pathname | back to summary |
|---|---|
| private String pathname The pathname (absolute or relative to Catalina's current working directory) of the XML file containing our database information. | |
| principals | back to summary |
|---|---|
| private final Map<String, GenericPrincipal> principals The set of valid Principals for this Realm, keyed by user name. | |
| MemoryRealm | back to summary |
|---|---|
| public MemoryRealm() | |
| addUser | back to summary |
|---|---|
| pack-priv void addUser(String username, String password, String roles) Add a new user to the in-memory database. | |
| authenticate | back to summary |
|---|---|
| public Principal authenticate(String username, String credentials) Overrides org. Implements org. Doc from org. Try to authenticate using the specified username and credentials. | |
| getDigester | back to summary |
|---|---|
protected Digester getDigester()
| |
| getPassword | back to summary |
|---|---|
| protected String getPassword(String username) Implements abstract org. Doc from org. Get the password for the specified user. | |
| getPathname | back to summary |
|---|---|
public String getPathname()
| |
| getPrincipal | back to summary |
|---|---|
| protected Principal getPrincipal(String username) Implements abstract org. Doc from org. Get the principal associated with the specified user. | |
| setPathname | back to summary |
|---|---|
| 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".
| |
| startInternal | back to summary |
|---|---|
| protected void startInternal() throws LifecycleException Overrides org. Doc from org. Prepare for the beginning of active use of the public methods of this component and implement the requirements of
| |