org.w3c.jigsaw.auth
Class AuthFilter

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.tools.resources.ResourceFrame
                  extended by org.w3c.tools.resources.ResourceFilter
                      extended by org.w3c.jigsaw.auth.AuthFilter
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, AttributeChangedListener, FrameEventListener, FilterInterface
Direct Known Subclasses:
DigestAuthFilter, GenericAuthFilter

public class AuthFilter
extends ResourceFilter

General authentication filters.


Field Summary
protected static int ATTR_METHODS
          Attribute index - The methods protected by the filter.
protected static int ATTR_PRIVATE_CACHABILITY
          Attribute index - Is caching allowed in private cache ?
protected static int ATTR_PUBLIC_CACHABILITY
          Attribute index - Is public caching of protected documents allowed ?
protected static int ATTR_REALM
          Attribute index - The realm name for this filter.
protected static int ATTR_SHARED_CACHABILITY
          Attribute index - Is caching allowed by a shared cache ?
static java.lang.String STATE_AUTHCONTEXT
          The authentication context used to authenticate the above user FIXME
static java.lang.String STATE_AUTHTYPE
          The authentication method used to authenticate above user.
static java.lang.String STATE_AUTHUSER
          The user as authentified from the request.
 
Fields inherited from class org.w3c.tools.resources.ResourceFrame
filterClass, frameListener, resource
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, values
 
Constructor Summary
AuthFilter()
           
 
Method Summary
 void authenticate(Request request)
          Authenticate the request from the given client.
 java.lang.String[] getMethods()
          Get the list of methods that this filter protect
 boolean getPrivateCachability()
          Is this document cachable in private caches ?
 boolean getPublicCachability()
          Is this document publicly cachable ?
 java.lang.String getRealm()
          Get the realm of this filter.
 boolean getSharedCachability()
          Is this document cachable in shared caches ?
 boolean lookup(LookupState ls, LookupResult lr)
          Authenticate the given request for the given client.
 ReplyInterface outgoingFilter(RequestInterface request, ReplyInterface reply)
          Add the appropriate cache control directives on the way back.
 
Methods inherited from class org.w3c.tools.resources.ResourceFilter
exceptionFilter, getTargetResource, ingoingFilter, ingoingFilter, initialize, outgoingFilter, outputFilter, pickleValues
 
Methods inherited from class org.w3c.tools.resources.ResourceFrame
addFrameEventListener, attributeChanged, checkRequest, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, perform, postFrameEvent, processEvent, registerResource, removeFrameEventListener, setValue, unregisterResource, updateDefaultChildAttributes
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, initialize, markModified, notifyUnload, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_AUTHUSER

public static final java.lang.String STATE_AUTHUSER
The user as authentified from the request. FIXME

See Also:
Constant Field Values

STATE_AUTHTYPE

public static final java.lang.String STATE_AUTHTYPE
The authentication method used to authenticate above user. FIXME

See Also:
Constant Field Values

STATE_AUTHCONTEXT

public static final java.lang.String STATE_AUTHCONTEXT
The authentication context used to authenticate the above user FIXME

See Also:
Constant Field Values

ATTR_METHODS

protected static int ATTR_METHODS
Attribute index - The methods protected by the filter.


ATTR_REALM

protected static int ATTR_REALM
Attribute index - The realm name for this filter.


ATTR_SHARED_CACHABILITY

protected static int ATTR_SHARED_CACHABILITY
Attribute index - Is caching allowed by a shared cache ?


ATTR_PRIVATE_CACHABILITY

protected static int ATTR_PRIVATE_CACHABILITY
Attribute index - Is caching allowed in private cache ?


ATTR_PUBLIC_CACHABILITY

protected static int ATTR_PUBLIC_CACHABILITY
Attribute index - Is public caching of protected documents allowed ?

Constructor Detail

AuthFilter

public AuthFilter()
Method Detail

getMethods

public java.lang.String[] getMethods()
Get the list of methods that this filter protect

Returns:
An array of String giving the name of the protected methods, or null, in wich case all methods are to be protected.

getRealm

public java.lang.String getRealm()
Get the realm of this filter.


getPublicCachability

public boolean getPublicCachability()
Is this document publicly cachable ?

Returns:
A boolean.

getPrivateCachability

public boolean getPrivateCachability()
Is this document cachable in private caches ?

Returns:
A boolean.

getSharedCachability

public boolean getSharedCachability()
Is this document cachable in shared caches ?

Returns:
A boolean.

authenticate

public void authenticate(Request request)
                  throws ProtocolException
Authenticate the request from the given client. An authentication filter should only override this method.

Parameters:
request - The request to be handled.
Throws:
ProtocolException - If authentication failed.

lookup

public boolean lookup(LookupState ls,
                      LookupResult lr)
               throws ProtocolException
Authenticate the given request for the given client. This method is invoked prior to any request handling on its target entity. If the used authentication method allows so, AuthFilters should set the authuser attribute of the request.

Specified by:
lookup in interface FilterInterface
Overrides:
lookup in class ResourceFilter
Parameters:
request - The request.
Returns:
A boolean, true if this filter has performed the whole lookup, and side-effect the lookup result appropriatelly, false otherwise.
Throws:
ProtocolException - If authentication failed.

outgoingFilter

public ReplyInterface outgoingFilter(RequestInterface request,
                                     ReplyInterface reply)
Add the appropriate cache control directives on the way back.

Overrides:
outgoingFilter in class ResourceFilter
Parameters:
request - The request that has been processed.
reply - The original reply.
Returns:
Always null.