SPT Core API

com.sptci.auth
Class AuthorisationFilter

java.lang.Object
  extended by com.sptci.auth.Filter
      extended by com.sptci.auth.AuthorisationFilter
All Implemented Interfaces:
Filter

public class AuthorisationFilter
extends Filter

A filter that implements authorisation based on group membership.

Copyright 2006 Sans Pareil Technologies, Inc.

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

Field Summary
 
Fields inherited from class com.sptci.auth.Filter
filterConfig, logger, USER
 
Constructor Summary
AuthorisationFilter()
           
 
Method Summary
protected  void displayError(HttpServletResponse response)
          Send back an error page to the client if an un-authorised access was attempted.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Implementation of the filter action.
 void init(FilterConfig filterConfig)
          Over-ridden to initialise authoriser and groups.
 
Methods inherited from class com.sptci.auth.Filter
destroy, setFilterConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorisationFilter

public AuthorisationFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
          throws ServletException
Over-ridden to initialise authoriser and groups.

Specified by:
init in interface Filter
Overrides:
init in class Filter
Parameters:
filterConfig - - A reference to the configuration object used by the servlet container to pass information to the filter.
Throws:
ServletException - - If an exception is encountered while fetching the initialisation parameters from the specified filterConfig object reference.

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException
Implementation of the filter action. Look up the user attribute from the request and check group membership.

Specified by:
doFilter in interface Filter
Overrides:
doFilter in class Filter
Throws:
IOException
ServletException
See Also:
Authoriser.checkAuthorisation(com.sptci.auth.User, java.lang.String[])

displayError

protected void displayError(HttpServletResponse response)
                     throws ServletException,
                            IOException
Send back an error page to the client if an un-authorised access was attempted.

Parameters:
response - The servlet response object.
Throws:
ServletException - If a servlet exception is raised.
IOException - If errors are encountered while writing the data.

SPT Core API