Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

net.sf.acegisecurity.adapters.catalina
Class CatalinaAcegiUserRealm  view CatalinaAcegiUserRealm download CatalinaAcegiUserRealm.java

java.lang.Object
  extended byorg.apache.catalina.realm.RealmBase
      extended bynet.sf.acegisecurity.adapters.catalina.CatalinaAcegiUserRealm
All Implemented Interfaces:
org.apache.catalina.Lifecycle, javax.management.MBeanRegistration, org.apache.catalina.Realm

public class CatalinaAcegiUserRealm
extends org.apache.catalina.realm.RealmBase

Adapter to enable Catalina (Tomcat) to authenticate via the Acegi Security System for Spring.

Returns a net.sf.acegisecurity.adapters.PrincipalAcegiUserToken to Catalina's authentication system, which is subsequently available via HttpServletRequest.getUserPrincipal().

Version:
$Id: CatalinaAcegiUserRealm.java,v 1.7 2004/09/02 23:51:38 benalex Exp $

Field Summary
private  java.lang.String appContextLocation
           
private  net.sf.acegisecurity.AuthenticationManager authenticationManager
           
private  org.apache.catalina.Container container
           
private  java.lang.String key
           
private static org.apache.commons.logging.Log logger
           
protected  java.lang.String name
           
 
Fields inherited from class org.apache.catalina.realm.RealmBase
containerLog, controller, 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, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
CatalinaAcegiUserRealm()
           
 
Method Summary
 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.
 java.security.Principal authenticate(java.lang.String username, java.lang.String digest, java.lang.String nonce, java.lang.String nc, java.lang.String cnonce, java.lang.String qop, java.lang.String realm, java.lang.String md5a2)
          Not supported, returns null
 java.security.Principal authenticate(java.security.cert.X509Certificate[] x509Certificates)
          Not supported, returns null
 java.lang.String getAppContextLocation()
           
 java.lang.String getKey()
           
protected  java.lang.String getName()
          Return a short name for this Realm implementation, for use in log messages.
protected  java.lang.String getPassword(java.lang.String arg0)
          Always returns null (we override authenticate methods)
protected  java.security.Principal getPrincipal(java.lang.String arg0)
          Always returns null (we override authenticate methods)
 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 setAppContextLocation(java.lang.String appContextLocation)
           
 void setKey(java.lang.String key)
           
 void start()
          Provides the method that Catalina will use to start the container.
private  void start(boolean startParent)
           
protected  void startForTest()
          Provides a method to load the container adapter without delegating to the superclass, which cannot operate outside the Catalina container.
 
Methods inherited from class org.apache.catalina.realm.RealmBase
addLifecycleListener, addPropertyChangeListener, backgroundProcess, destroy, digest, Digest, findLifecycleListeners, findSecurityConstraints, getContainer, getController, getDigest, getDigest, getDigestEncoding, getDomain, getInfo, getObjectName, getType, getValidate, hasMessageDigest, hasResourcePermission, hasUserDataPermission, init, main, postDeregister, postRegister, preDeregister, preRegister, removeLifecycleListener, removePropertyChangeListener, setContainer, setController, setDigest, setDigestEncoding, setValidate, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger

name

protected final java.lang.String name
See Also:
Constant Field Values

authenticationManager

private net.sf.acegisecurity.AuthenticationManager authenticationManager

container

private org.apache.catalina.Container container

appContextLocation

private java.lang.String appContextLocation

key

private java.lang.String key
Constructor Detail

CatalinaAcegiUserRealm

public CatalinaAcegiUserRealm()
Method Detail

setAppContextLocation

public void setAppContextLocation(java.lang.String appContextLocation)

getAppContextLocation

public java.lang.String getAppContextLocation()

setKey

public void setKey(java.lang.String key)

getKey

public java.lang.String getKey()

authenticate

public java.security.Principal authenticate(java.lang.String username,
                                            java.lang.String credentials)
Description copied from class: org.apache.catalina.realm.RealmBase
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.


authenticate

public java.security.Principal authenticate(java.lang.String username,
                                            byte[] credentials)
Description copied from class: org.apache.catalina.realm.RealmBase
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null.


authenticate

public java.security.Principal authenticate(java.lang.String username,
                                            java.lang.String digest,
                                            java.lang.String nonce,
                                            java.lang.String nc,
                                            java.lang.String cnonce,
                                            java.lang.String qop,
                                            java.lang.String realm,
                                            java.lang.String md5a2)
Not supported, returns null


authenticate

public java.security.Principal authenticate(java.security.cert.X509Certificate[] x509Certificates)
Not supported, returns null


hasRole

public boolean hasRole(java.security.Principal principal,
                       java.lang.String role)
Description copied from class: org.apache.catalina.realm.RealmBase
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.


start

public void start()
           throws org.apache.catalina.LifecycleException
Provides the method that Catalina will use to start the container.


getName

protected java.lang.String getName()
Description copied from class: org.apache.catalina.realm.RealmBase
Return a short name for this Realm implementation, for use in log messages.


getPassword

protected java.lang.String getPassword(java.lang.String arg0)
Always returns null (we override authenticate methods)


getPrincipal

protected java.security.Principal getPrincipal(java.lang.String arg0)
Always returns null (we override authenticate methods)


startForTest

protected void startForTest()
                     throws org.apache.catalina.LifecycleException
Provides a method to load the container adapter without delegating to the superclass, which cannot operate outside the Catalina container.


start

private void start(boolean startParent)
            throws org.apache.catalina.LifecycleException