org.sakaiproject.dav
Class DavRealm

java.lang.Object
  extended byorg.apache.catalina.realm.RealmBase
      extended byorg.sakaiproject.dav.DavRealm
All Implemented Interfaces:
org.apache.catalina.Lifecycle, MBeanRegistration, org.apache.catalina.Realm

public final class DavRealm
extends org.apache.catalina.realm.RealmBase

Simple implementation of Realm that consults the Sakai user directory service to provide container security equivalent to then application security in CHEF.

IMPLEMENTATION NOTE: The user is assumed to have all "roles" because servlets and teamlets will enforce roles within CHEF - so in this realm, we simply indicate "true".

Version:
$Revision: 632 $ $Date: 2005-07-14 17:22:50 -0400 (Thu, 14 Jul 2005) $
Author:
Charles Severance

Field Summary
protected  String info
          Descriptive information about this Realm implementation.
protected static String name
          Descriptive information about this Realm implementation.
 
Fields inherited from class org.apache.catalina.realm.RealmBase
container, containerLog, controller, digest, digestEncoding, domain, host, 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, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
DavRealm()
           
 
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)
           
 boolean hasRole(Principal principal, String role)
           
 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
addLifecycleListener, addPropertyChangeListener, authenticate, authenticate, authenticate, backgroundProcess, destroy, digest, Digest, findLifecycleListeners, findSecurityConstraints, getContainer, getController, getDigest, getDigest, getDigestEncoding, getDomain, getObjectName, getType, getValidate, hasMessageDigest, hasResourcePermission, hasUserDataPermission, init, main, postDeregister, postRegister, preDeregister, preRegister, removeLifecycleListener, removePropertyChangeListener, setContainer, setController, setDigest, setDigestEncoding, setValidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

info

protected final String info
Descriptive information about this Realm implementation.

See Also:
Constant Field Values

name

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

See Also:
Constant Field Values
Constructor Detail

DavRealm

public DavRealm()
Method Detail

getInfo

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


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.

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

getName

protected String getName()
Return a short name for this Realm implementation.


getPrincipal

protected Principal getPrincipal(String username)

getPassword

protected String getPassword(String username)
Return the password associated with the given principal's user name.


start

public void start()
           throws org.apache.catalina.LifecycleException
Prepare for active use of the public methods of this Component.

Throws:
IllegalStateException - if this component has already been started
org.apache.catalina.LifecycleException - if this component detects a fatal error that prevents it from being started

stop

public void stop()
          throws org.apache.catalina.LifecycleException
Gracefully shut down active use of the public methods of this Component.

Throws:
IllegalStateException - if this component has not been started
org.apache.catalina.LifecycleException - if this component detects a fatal error that needs to be reported

hasRole

public boolean hasRole(Principal principal,
                       String role)