All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.auth.GenericAuthFilter

java.lang.Object
   |
   +----w3c.tools.store.AttributeHolder
           |
           +----w3c.tools.store.Resource
                   |
                   +----w3c.tools.store.ResourceFrame
                           |
                           +----w3c.jigsaw.resources.ResourceFilter
                                   |
                                   +----w3c.jigsaw.auth.AuthFilter
                                           |
                                           +----w3c.jigsaw.auth.GenericAuthFilter

public class GenericAuthFilter
extends AuthFilter
GenericAuthFilter provides for both IP and basic authentication. This is really a first implementation. It looses on several points: However, this provides for the basic functionnalities.


Variable Index

 o ATTR_ALLOWED_GROUPS
Attribute index - The list of allowed groups.
 o ATTR_ALLOWED_USERS
Attribute index - The list of allowed users.
 o catalog
The catalog of realms that make our scope.
 o challenge
The challenge to issue to any client for Basic Authentication.
 o ipmatcher
The IPMatcher to match IP templates to user records.
 o loaded_realm
The nam of the realm we cache in realm.
 o realm
Our associated realm.

Constructor Index

 o GenericAuthFilter()

Method Index

 o acquireRealm()
Get a pointer to our realm, and initialize our ipmatcher.
 o authenticate(Request)
Authenticate the given request.
 o checkBasicAuth(BasicAuthContext)
Check the given Basic context against our database.
 o checkRealm()
Check that our realm does exist.
 o checkUser(AuthUser)
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).
 o getAllowedGroups()
Get the list of allowed groups.
 o getAllowedUsers()
Get the list of allowed users.
 o initialize(Object[])
Initialize the filter.
 o lookupUser(InetAddress)
Lookup a user by its IP address.
 o lookupUser(String)
Lookup a user by its name.
 o setValue(int, Object)
Catch set value on the realm, to maintain cached values.

Variables

 o ATTR_ALLOWED_USERS
 protected static int ATTR_ALLOWED_USERS
Attribute index - The list of allowed users.

 o ATTR_ALLOWED_GROUPS
 protected static int ATTR_ALLOWED_GROUPS
Attribute index - The list of allowed groups.

 o ipmatcher
 protected IPMatcher ipmatcher
The IPMatcher to match IP templates to user records.

 o catalog
 protected RealmsCatalog catalog
The catalog of realms that make our scope.

 o realm
 protected AuthRealm realm
Our associated realm.

 o loaded_realm
 protected String loaded_realm
The nam of the realm we cache in realm.

 o challenge
 protected HttpChallenge challenge
The challenge to issue to any client for Basic Authentication.

Constructors

 o GenericAuthFilter
 public GenericAuthFilter()

Methods

 o acquireRealm
 protected synchronized void acquireRealm()
Get a pointer to our realm, and initialize our ipmatcher.

 o checkRealm
 protected synchronized boolean checkRealm()
Check that our realm does exist. Otherwise we are probably being initialized, and we don't authenticate yet.

Returns:
A boolean true if realm can be initialized.
 o getAllowedUsers
 public String[] getAllowedUsers()
Get the list of allowed users.

 o getAllowedGroups
 public String[] getAllowedGroups()
Get the list of allowed groups.

 o lookupUser
 public synchronized AuthUser lookupUser(InetAddress ipaddr)
Lookup a user by its IP address.

Parameters:
ipaddr - The IP address to look for.
Returns:
An AuthUser instance or null.
 o lookupUser
 public synchronized AuthUser lookupUser(String name)
Lookup a user by its name.

Parameters:
name - The user's name.
Returns:
An AuthUser instance, or null.
 o checkBasicAuth
 protected AuthUser checkBasicAuth(BasicAuthContext ctxt)
Check the given Basic context against our database.

Parameters:
ctxt - The basic auth context to check.
Returns:
A AuthUser instance if check succeeded, null otherwise.
 o checkUser
 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). If no allowed users or allowed groups are defined, than simply check for the existence of this user.

Returns:
A boolean true if access allowed.
 o setValue
 public void setValue(int idx,
                      Object value)
Catch set value on the realm, to maintain cached values.

Overrides:
setValue in class Resource
 o authenticate
 public void authenticate(Request request) throws HTTPException
Authenticate the given request. We first check for valid authentication information. If no authentication is provided, than we try to map the IP address to some of the ones we know about. If the IP address is not found, we challenge the client for a password.

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.

Parameters:
request - The request to be authentified.
Overrides:
authenticate in class AuthFilter
 o initialize
 public void initialize(Object values[])
Initialize the filter.

Overrides:
initialize in class ResourceFilter

All Packages  Class Hierarchy  This Package  Previous  Next  Index