Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.securityfilter.filter
Class SecurityFilter  view SecurityFilter download SecurityFilter.java

java.lang.Object
  extended byorg.securityfilter.filter.SecurityFilter
All Implemented Interfaces:
javax.servlet.Filter

public class SecurityFilter
extends java.lang.Object
implements javax.servlet.Filter

SecurityFilter provides authentication and authorization services.

Version:
$Revision: 1.21 $ $Date: 2003/07/07 13:12:57 $

Field Summary
static java.lang.String ALREADY_PROCESSED
           
protected  org.securityfilter.authenticator.Authenticator authenticator
           
protected  javax.servlet.FilterConfig config
           
static java.lang.String CONFIG_FILE_KEY
           
static java.lang.String DEFAULT_CONFIG_FILE
           
protected  URLPatternFactory patternFactory
           
protected  java.util.List patternList
           
protected  org.securityfilter.realm.SecurityRealmInterface realm
           
static java.lang.String SAVED_REQUEST
           
static java.lang.String SAVED_REQUEST_URL
           
static java.lang.String TRUE
           
static java.lang.String VALIDATE_KEY
           
 
Constructor Summary
SecurityFilter()
           
 
Method Summary
 void destroy()
          Destroy the filter, releasing resources.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Perform filtering operation, and optionally pass the request down the chain.
private static void fixProtocol(java.lang.StringBuffer url, javax.servlet.http.HttpServletRequest request)
          Fix the protocol portion of an absolute url.
static java.lang.String getContinueToURL(javax.servlet.http.HttpServletRequest request)
          Get the URL to continue to after successful login.
 javax.servlet.FilterConfig getFilterConfig()
          Get the filter config object, included for WebLogic 6 compatibility.
private static java.lang.StringBuffer getRequestURL(javax.servlet.http.HttpServletRequest request)
          Get the requestURL.
private static java.lang.String getSaveableURL(javax.servlet.http.HttpServletRequest request)
          Return a URL suitable for saving or matching against a saved URL.
protected  SavedRequest getSavedRequest(javax.servlet.http.HttpServletRequest request)
          If this request matches the one we saved, return the SavedRequest and remove it from the session.
 void init(javax.servlet.FilterConfig config)
          Initialize the SecurityFilter.
protected  URLPattern matchPattern(java.lang.String pattern, java.lang.String httpMethod, URLPatternMatcher matcher)
          Find a match for the requested pattern & method, if any.
static void saveRequestInformation(javax.servlet.http.HttpServletRequest request)
          Save request information to re-use when the user is successfully authenticated.
 void setFilterConfig(javax.servlet.FilterConfig config)
          Set the filter configuration, included for WebLogic 6 compatibility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE_KEY

public static final java.lang.String CONFIG_FILE_KEY
See Also:
Constant Field Values

DEFAULT_CONFIG_FILE

public static final java.lang.String DEFAULT_CONFIG_FILE
See Also:
Constant Field Values

VALIDATE_KEY

public static final java.lang.String VALIDATE_KEY
See Also:
Constant Field Values

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

ALREADY_PROCESSED

public static final java.lang.String ALREADY_PROCESSED

SAVED_REQUEST_URL

public static final java.lang.String SAVED_REQUEST_URL

SAVED_REQUEST

public static final java.lang.String SAVED_REQUEST

config

protected javax.servlet.FilterConfig config

realm

protected org.securityfilter.realm.SecurityRealmInterface realm

patternList

protected java.util.List patternList

patternFactory

protected URLPatternFactory patternFactory

authenticator

protected org.securityfilter.authenticator.Authenticator authenticator
Constructor Detail

SecurityFilter

public SecurityFilter()
Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Perform filtering operation, and optionally pass the request down the chain.

Specified by:
doFilter in interface javax.servlet.Filter

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Initialize the SecurityFilter.

Specified by:
init in interface javax.servlet.Filter

destroy

public void destroy()
Destroy the filter, releasing resources.

Specified by:
destroy in interface javax.servlet.Filter

matchPattern

protected URLPattern matchPattern(java.lang.String pattern,
                                  java.lang.String httpMethod,
                                  URLPatternMatcher matcher)
                           throws java.lang.Exception
Find a match for the requested pattern & method, if any.


getSavedRequest

protected SavedRequest getSavedRequest(javax.servlet.http.HttpServletRequest request)
If this request matches the one we saved, return the SavedRequest and remove it from the session.


getContinueToURL

public static java.lang.String getContinueToURL(javax.servlet.http.HttpServletRequest request)
Get the URL to continue to after successful login. This may be the SAVED_REQUEST_URL if the authorization sequence was initiated by the filter, or the default URL (as specified in the config file) if a login request was spontaneously submitted.


saveRequestInformation

public static void saveRequestInformation(javax.servlet.http.HttpServletRequest request)
Save request information to re-use when the user is successfully authenticated.


getSaveableURL

private static java.lang.String getSaveableURL(javax.servlet.http.HttpServletRequest request)
Return a URL suitable for saving or matching against a saved URL.

This is the whole URL, plus the query string.


setFilterConfig

public void setFilterConfig(javax.servlet.FilterConfig config)
                     throws javax.servlet.ServletException
Set the filter configuration, included for WebLogic 6 compatibility.


getFilterConfig

public javax.servlet.FilterConfig getFilterConfig()
Get the filter config object, included for WebLogic 6 compatibility.


getRequestURL

private static java.lang.StringBuffer getRequestURL(javax.servlet.http.HttpServletRequest request)
Get the requestURL. This method is called when the app server fails to implement HttpServletRequest.getRequestURL(). Orion 1.5.2 is one such server.


fixProtocol

private static void fixProtocol(java.lang.StringBuffer url,
                                javax.servlet.http.HttpServletRequest request)
Fix the protocol portion of an absolute url. Often, the protocol will be http: even for https: requests. todo: needs testing to make sure this is proper in all circumstances