|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource org.w3c.tools.resources.FramedResource org.w3c.tools.resources.ResourceFrame org.w3c.tools.resources.ResourceFilter org.w3c.jigsaw.auth.AuthFilter org.w3c.jigsaw.auth.GenericAuthFilter
public class GenericAuthFilter
GenericAuthFilter provides for both IP and basic authentication. This is really a first implementation. It looses on several points:
Field Summary | |
---|---|
protected static int |
ATTR_ALLOWED_GROUPS
Attribute index - The list of allowed groups. |
protected static int |
ATTR_ALLOWED_USERS
Attribute index - The list of allowed users. |
protected RealmsCatalog |
catalog
The catalog of realms that make our scope. |
protected HttpChallenge |
challenge
The challenge to issue to any client for Basic Authentication. |
protected IPMatcher |
ipmatcher
The IPMatcher to match IP templates to user records. |
protected java.lang.String |
loaded_realm
The nam of the realm we cache in realm . |
protected ResourceReference |
rr_realm
Our associated realm. |
Fields inherited from class org.w3c.jigsaw.auth.AuthFilter |
---|
ATTR_METHODS, ATTR_PRIVATE_CACHABILITY, ATTR_PUBLIC_CACHABILITY, ATTR_REALM, ATTR_SHARED_CACHABILITY, STATE_AUTHCONTEXT, STATE_AUTHTYPE, STATE_AUTHUSER |
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 | |
---|---|
GenericAuthFilter()
|
Method Summary | |
---|---|
protected void |
acquireRealm()
Get a pointer to our realm, and initialize our ipmatcher. |
void |
authenticate(Request request)
Authenticate the given request. |
protected ResourceReference |
checkBasicAuth(org.w3c.jigsaw.auth.BasicAuthContext ctxt)
Check the given Basic context against our database. |
protected boolean |
checkRealm()
Check that our realm does exist. |
protected boolean |
checkUser(AuthUser user)
Is this user allowed in the realm ? First check in the list of allowed users (if any), than in the list of allowed groups (if any). |
java.lang.String[] |
getAllowedGroups()
Get the list of allowed groups. |
java.lang.String[] |
getAllowedUsers()
Get the list of allowed users. |
void |
initialize(java.lang.Object[] values)
Initialize the filter. |
ResourceReference |
lookupUser(java.net.InetAddress ipaddr)
Lookup a user by its IP address. |
ResourceReference |
lookupUser(java.lang.String name)
Lookup a user by its name. |
void |
setValue(int idx,
java.lang.Object value)
Catch set value on the realm, to maintain cached values. |
Methods inherited from class org.w3c.jigsaw.auth.AuthFilter |
---|
getMethods, getPrivateCachability, getPublicCachability, getRealm, getSharedCachability, lookup, outgoingFilter |
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, unregisterResource, updateDefaultChildAttributes |
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 |
---|
protected static int ATTR_ALLOWED_USERS
protected static int ATTR_ALLOWED_GROUPS
protected IPMatcher ipmatcher
protected RealmsCatalog catalog
protected ResourceReference rr_realm
protected java.lang.String loaded_realm
realm
.
protected HttpChallenge challenge
Constructor Detail |
---|
public GenericAuthFilter()
Method Detail |
---|
protected void acquireRealm()
protected boolean checkRealm()
public java.lang.String[] getAllowedUsers()
public java.lang.String[] getAllowedGroups()
public ResourceReference lookupUser(java.net.InetAddress ipaddr)
ipaddr
- The IP address to look for.
public ResourceReference lookupUser(java.lang.String name)
name
- The user's name.
protected ResourceReference checkBasicAuth(org.w3c.jigsaw.auth.BasicAuthContext ctxt)
ctxt
- The basic auth context to check.
protected boolean checkUser(AuthUser user)
public void setValue(int idx, java.lang.Object value)
setValue
in class ResourceFrame
idx
- The index of the attribute to modify.value
- The new attribute value.public void authenticate(Request request) throws ProtocolException
If the IP address is found, than either our user entry requires an extra password step (in wich case we challenge it), or simple IP based authentication is enough, so we allow the request.
authenticate
in class AuthFilter
request
- The request to be authentified.
ProtocolException
- if authentication
failedpublic void initialize(java.lang.Object[] values)
initialize
in class FramedResource
values
- Default attribute values.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |