org.apache.catalina.realm

Class UserDatabaseRealm

Implemented Interfaces:
Lifecycle, MBeanRegistration, Realm

public class UserDatabaseRealm
extends RealmBase

Implementation of Realm that is based on an implementation of UserDatabase made available through the global JNDI resources configured for this instance of Catalina. Set the resourceName parameter to the global JNDI resources name for the configured instance of UserDatabase that we should consult.

Version:
$Revision: 1.5 $ $Date: 2004/02/27 22:03:03 $

Author:
Craig R. McClanahan

Since:
4.1

Field Summary

protected UserDatabase
database
The UserDatabase we will use to authenticate users and identify associated roles.
protected String
info
Descriptive information about this Realm implementation.
protected static String
name
Descriptive information about this Realm implementation.
protected String
resourceName
The global JNDI name of the UserDatabase resource we will be utilizing.

Fields inherited from class org.apache.catalina.realm.RealmBase

container, controller, debug, digest, digestEncoding, domain, host, info, initialized, lifecycle, md, md5Encoder, md5Helper, mserver, oname, path, sm, started, support, type, validate

Fields inherited from interface org.apache.catalina.Lifecycle

AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT

Method Summary

Principal
authenticate(String username, String credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.
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.
protected Principal
getPrincipal(String username)
Return the Principal associated with the given user name.
String
getResourceName()
Return the global JNDI name of the UserDatabase resource we will be using.
void
setResourceName(String resourceName)
Set the global JNDI name of the UserDatabase resource we will be using.
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

Digest, addLifecycleListener, addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, destroy, digest, findLifecycleListeners, findSecurityConstraints, getContainer, getController, getDebug, getDigest, getDigest, getDigestEncoding, getDomain, getInfo, getName, getObjectName, getPassword, getPrincipal, getType, getValidate, hasMessageDigest, hasResourcePermission, hasRole, hasUserDataPermission, init, log, log, main, postDeregister, postRegister, preDeregister, preRegister, removeLifecycleListener, removePropertyChangeListener, setContainer, setController, setDebug, setDigest, setDigestEncoding, setValidate, start, stop

Field Details

database

protected UserDatabase database
The UserDatabase we will use to authenticate users and identify associated roles.


info

protected final String info
Descriptive information about this Realm implementation.


name

protected static final String name
Descriptive information about this Realm implementation.


resourceName

protected String resourceName
The global JNDI name of the UserDatabase resource we will be utilizing.

Method Details

authenticate

public Principal authenticate(String username,
                              String credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.
Specified by:
authenticate in interface Realm
Overrides:
authenticate in interface RealmBase

Parameters:
username - Username of the Principal to look up
credentials - Password or other credentials to use in authenticating this username


getInfo

public String getInfo()
Return descriptive information about this Realm implementation and the corresponding version number, in the format <description>/<version>.
Specified by:
getInfo in interface Realm
Overrides:
getInfo in interface RealmBase


getName

protected String getName()
Return a short name for this Realm implementation.
Overrides:
getName in interface RealmBase


getPassword

protected String getPassword(String username)
Return the password associated with the given principal's user name.
Overrides:
getPassword in interface RealmBase


getPrincipal

protected Principal getPrincipal(String username)
Return the Principal associated with the given user name.
Overrides:
getPrincipal in interface RealmBase


getResourceName

public String getResourceName()
Return the global JNDI name of the UserDatabase resource we will be using.


setResourceName

public void setResourceName(String resourceName)
Set the global JNDI name of the UserDatabase resource we will be using.

Parameters:
resourceName - The new global JNDI name


start

public void start()
            throws LifecycleException
Prepare for active use of the public methods of this Component.
Specified by:
start in interface Lifecycle
Overrides:
start in interface RealmBase

Throws:
LifecycleException - if this component detects a fatal error that prevents it from being started


stop

public void stop()
            throws LifecycleException
Gracefully shut down active use of the public methods of this Component.
Specified by:
stop in interface Lifecycle
Overrides:
stop in interface RealmBase

Throws:
LifecycleException - if this component detects a fatal error that needs to be reported


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.