SPT Core API

com.sptci.auth
Class Authoriser

java.lang.Object
  extended by com.sptci.auth.Authoriser
Direct Known Subclasses:
DatabaseAuthoriser

public abstract class Authoriser
extends Object

An abstract authoriser used to implement authorisation for application components.

Copyright 2006, Sans Pareil Technologies, Inc.

Version:
$Id: Authoriser.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2006-11-15

Nested Class Summary
protected static class Authoriser.ManagerTask
          A TimerTask that is used to clear the userMap periodically.
 
Field Summary
protected static String ALL_GROUPS
          The special group name to denote that all authenticated users are allowed access.
protected static Logger logger
          The logger that is used to log errors or other messages.
protected static Map<String,Boolean> userMap
          A Map used to cache userName and authorisation values.
 
Constructor Summary
Authoriser()
           
 
Method Summary
 boolean checkAuthorisation(User user, String[] groups)
          Check the authorisation credentials of the specified user against the list of groups specified.
protected abstract  boolean processAuthorisation(User user, String[] groups)
          Process the authorisation request by checking the specified user for membership in the list of groups specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
The logger that is used to log errors or other messages.


ALL_GROUPS

protected static final String ALL_GROUPS
The special group name to denote that all authenticated users are allowed access.

See Also:
Constant Field Values

userMap

protected static final Map<String,Boolean> userMap
A Map used to cache userName and authorisation values. Users who do not exist will be stored with a false authorisation status.

Constructor Detail

Authoriser

public Authoriser()
Method Detail

checkAuthorisation

public boolean checkAuthorisation(User user,
                                  String[] groups)
Check the authorisation credentials of the specified user against the list of groups specified.

Parameters:
user - The user object which is used to verify for group membership.
groups - The groups that are allowed access to the application.
Returns:
boolean Returns true if the user is a member of any of the groups specified.
See Also:
processAuthorisation(com.sptci.auth.User, java.lang.String[])

processAuthorisation

protected abstract boolean processAuthorisation(User user,
                                                String[] groups)
Process the authorisation request by checking the specified user for membership in the list of groups specified.

Parameters:
user - The user object which is used to verify for group membership.
groups - The groups that are allowed access to the application.
Returns:
boolean Returns true if the user is a member of any of the groups specified.

SPT Core API