org.mortbay.jetty.security
Class SecurityHandler

java.lang.Object
  extended byorg.mortbay.component.AbstractLifeCycle
      extended byorg.mortbay.jetty.handler.AbstractHandler
          extended byorg.mortbay.jetty.handler.AbstractHandlerContainer
              extended byorg.mortbay.jetty.handler.HandlerWrapper
                  extended byorg.mortbay.jetty.security.SecurityHandler
All Implemented Interfaces:
Handler, HandlerContainer, LifeCycle

public class SecurityHandler
extends HandlerWrapper

Handler to enforce SecurityConstraints.

Author:
Greg Wilkins (gregw)

Nested Class Summary
 class SecurityHandler.NotChecked
           
 
Field Summary
static Principal __NO_USER
           
static Principal __NOBODY
          Nobody user.
 
Fields inherited from class org.mortbay.jetty.handler.AbstractHandler
_string
 
Fields inherited from interface org.mortbay.jetty.Handler
ALL, DEFAULT, ERROR, FORWARD, INCLUDE, REQUEST
 
Constructor Summary
SecurityHandler()
           
 
Method Summary
 boolean checkSecurityConstraints(String pathInContext, Request request, Response response)
           
 void doStart()
           
 Authenticator getAuthenticator()
           
 String getAuthMethod()
           
 ConstraintMapping[] getConstraintMappings()
           
 UserRealm getUserRealm()
           
 void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
          Handle a request.
 void setAuthenticator(Authenticator authenticator)
           
 void setAuthMethod(String method)
           
 void setConstraintMappings(ConstraintMapping[] constraintMappings)
           
 void setUserRealm(UserRealm userRealm)
           
 
Methods inherited from class org.mortbay.jetty.handler.HandlerWrapper
addHandler, doStop, expandChildren, getHandler, setHandler, setServer
 
Methods inherited from class org.mortbay.jetty.handler.AbstractHandlerContainer
expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
 
Methods inherited from class org.mortbay.jetty.handler.AbstractHandler
getServer, toString
 
Methods inherited from class org.mortbay.component.AbstractLifeCycle
isFailed, isRunning, isStarted, isStarting, isStopping, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mortbay.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopping, start, stop
 

Field Detail

__NO_USER

public static Principal __NO_USER

__NOBODY

public static Principal __NOBODY
Nobody user. The Nobody UserPrincipal is used to indicate a partial state of authentication. A request with a Nobody UserPrincipal will be allowed past all authentication constraints - but will not be considered an authenticated request. It can be used by Authenticators such as FormAuthenticator to allow access to logon and error pages within an authenticated URI tree.

Constructor Detail

SecurityHandler

public SecurityHandler()
Method Detail

getAuthenticator

public Authenticator getAuthenticator()
Returns:
Returns the authenticator.

setAuthenticator

public void setAuthenticator(Authenticator authenticator)
Parameters:
authenticator - The authenticator to set.

getUserRealm

public UserRealm getUserRealm()
Returns:
Returns the userRealm.

setUserRealm

public void setUserRealm(UserRealm userRealm)
Parameters:
userRealm - The userRealm to set.

getConstraintMappings

public ConstraintMapping[] getConstraintMappings()
Returns:
Returns the contraintMappings.

setConstraintMappings

public void setConstraintMappings(ConstraintMapping[] constraintMappings)

getAuthMethod

public String getAuthMethod()

setAuthMethod

public void setAuthMethod(String method)

doStart

public void doStart()
             throws Exception
Overrides:
doStart in class HandlerWrapper
Throws:
Exception

handle

public void handle(String target,
                   HttpServletRequest request,
                   HttpServletResponse response,
                   int dispatch)
            throws IOException,
                   ServletException
Description copied from interface: Handler
Handle a request.

Specified by:
handle in interface Handler
Overrides:
handle in class HandlerWrapper
Throws:
IOException
ServletException

checkSecurityConstraints

public boolean checkSecurityConstraints(String pathInContext,
                                        Request request,
                                        Response response)
                                 throws IOException
Throws:
IOException