org.eclipse.jetty.security
类 SecurityHandler

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.component.AggregateLifeCycle
          继承者 org.eclipse.jetty.server.handler.AbstractHandler
              继承者 org.eclipse.jetty.server.handler.AbstractHandlerContainer
                  继承者 org.eclipse.jetty.server.handler.HandlerWrapper
                      继承者 org.eclipse.jetty.security.SecurityHandler
所有已实现的接口:
Authenticator.AuthConfiguration, Handler, HandlerContainer, Destroyable, Dumpable, LifeCycle
直接已知子类:
ConstraintSecurityHandler

public abstract class SecurityHandler
extends HandlerWrapper
implements Authenticator.AuthConfiguration

Abstract SecurityHandler. Select and apply an Authenticator to a request.

The Authenticator may either be directly set on the handler or will be create during AbstractLifeCycle.start() with a call to either the default or set AuthenticatorFactory.

SecurityHandler has a set of initparameters that are used by the Authentication.Configuration. At startup, any context init parameters that start with "org.eclipse.jetty.security." that do not have values in the SecurityHandler init parameters, are copied.


嵌套类摘要
 class SecurityHandler.NotChecked
           
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
static Principal __NO_USER
           
static Principal __NOBODY
          Nobody user.
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段
_handler
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
protected SecurityHandler()
           
 
方法摘要
protected  boolean checkSecurity(Request request)
           
protected abstract  boolean checkUserDataPermissions(String pathInContext, Request request, Response response, Object constraintInfo)
           
protected abstract  boolean checkWebResourcePermissions(String pathInContext, Request request, Response response, Object constraintInfo, UserIdentity userIdentity)
           
protected  void doStart()
          Start the managed lifecycle beans in the order they were added.
protected  void doStop()
          Stop the joined lifecycle beans in the reverse order they were added.
protected  IdentityService findIdentityService()
           
protected  LoginService findLoginService()
           
 Authenticator getAuthenticator()
           
 Authenticator.Factory getAuthenticatorFactory()
           
 String getAuthMethod()
           
static SecurityHandler getCurrentSecurityHandler()
           
 IdentityService getIdentityService()
          Get the identityService.
 String getInitParameter(String key)
          Get a SecurityHandler init parameter
 Set<String> getInitParameterNames()
          Get a SecurityHandler init parameter names
 LoginService getLoginService()
          Get the loginService.
 String getRealmName()
           
 void handle(String pathInContext, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
          Handle a request.
protected abstract  boolean isAuthMandatory(Request baseRequest, Response base_response, Object constraintInfo)
           
 boolean isCheckWelcomeFiles()
           
 boolean isSessionRenewedOnAuthentication()
           
 void logout(Authentication.User user)
           
protected abstract  Object prepareConstraintInfo(String pathInContext, Request request)
           
 void setAuthenticator(Authenticator authenticator)
          Set the authenticator.
 void setAuthenticatorFactory(Authenticator.Factory authenticatorFactory)
           
 void setAuthMethod(String authMethod)
           
 void setCheckWelcomeFiles(boolean authenticateWelcomeFiles)
           
 void setIdentityService(IdentityService identityService)
          Set the identityService.
 String setInitParameter(String key, String value)
          Set an initialization parameter.
 void setLoginService(LoginService loginService)
          Set the loginService.
 void setRealmName(String realmName)
           
 void setSessionRenewedOnAuthentication(boolean renew)
          Set renew the session on Authentication.
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler, setServer
 
从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法
dump, expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
 
从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法
dumpThis, getServer
 
从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

字段详细信息

__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.

构造方法详细信息

SecurityHandler

protected SecurityHandler()
方法详细信息

getIdentityService

public IdentityService getIdentityService()
Get the identityService.

指定者:
接口 Authenticator.AuthConfiguration 中的 getIdentityService
返回:
the identityService

setIdentityService

public void setIdentityService(IdentityService identityService)
Set the identityService.

参数:
identityService - the identityService to set

getLoginService

public LoginService getLoginService()
Get the loginService.

指定者:
接口 Authenticator.AuthConfiguration 中的 getLoginService
返回:
the loginService

setLoginService

public void setLoginService(LoginService loginService)
Set the loginService.

参数:
loginService - the loginService to set

getAuthenticator

public Authenticator getAuthenticator()

setAuthenticator

public void setAuthenticator(Authenticator authenticator)
Set the authenticator.

参数:
authenticator -
抛出:
IllegalStateException - if the SecurityHandler is running

getAuthenticatorFactory

public Authenticator.Factory getAuthenticatorFactory()
返回:
the authenticatorFactory

setAuthenticatorFactory

public void setAuthenticatorFactory(Authenticator.Factory authenticatorFactory)
参数:
authenticatorFactory - the authenticatorFactory to set
抛出:
IllegalStateException - if the SecurityHandler is running

getRealmName

public String getRealmName()
指定者:
接口 Authenticator.AuthConfiguration 中的 getRealmName
返回:
the realmName

setRealmName

public void setRealmName(String realmName)
参数:
realmName - the realmName to set
抛出:
IllegalStateException - if the SecurityHandler is running

getAuthMethod

public String getAuthMethod()
指定者:
接口 Authenticator.AuthConfiguration 中的 getAuthMethod
返回:
the authMethod

setAuthMethod

public void setAuthMethod(String authMethod)
参数:
authMethod - the authMethod to set
抛出:
IllegalStateException - if the SecurityHandler is running

isCheckWelcomeFiles

public boolean isCheckWelcomeFiles()
返回:
True if forwards to welcome files are authenticated

setCheckWelcomeFiles

public void setCheckWelcomeFiles(boolean authenticateWelcomeFiles)
参数:
authenticateWelcomeFiles - True if forwards to welcome files are authenticated
抛出:
IllegalStateException - if the SecurityHandler is running

getInitParameter

public String getInitParameter(String key)
从接口 Authenticator.AuthConfiguration 复制的描述
Get a SecurityHandler init parameter

指定者:
接口 Authenticator.AuthConfiguration 中的 getInitParameter
参数:
key - parameter name
返回:
Parameter value or null
另请参见:
getInitParameter(String)

getInitParameterNames

public Set<String> getInitParameterNames()
从接口 Authenticator.AuthConfiguration 复制的描述
Get a SecurityHandler init parameter names

指定者:
接口 Authenticator.AuthConfiguration 中的 getInitParameterNames
返回:
Set of parameter names
另请参见:
getInitParameterNames()

setInitParameter

public String setInitParameter(String key,
                               String value)
Set an initialization parameter.

参数:
key -
value -
返回:
previous value
抛出:
IllegalStateException - if the SecurityHandler is running

findLoginService

protected LoginService findLoginService()

findIdentityService

protected IdentityService findIdentityService()

doStart

protected void doStart()
                throws Exception
从类 AggregateLifeCycle 复制的描述
Start the managed lifecycle beans in the order they were added.

覆盖:
HandlerWrapper 中的 doStart
抛出:
Exception
另请参见:
AbstractLifeCycle.doStart()

doStop

protected void doStop()
               throws Exception
从类 AggregateLifeCycle 复制的描述
Stop the joined lifecycle beans in the reverse order they were added.

覆盖:
HandlerWrapper 中的 doStop
抛出:
Exception
另请参见:
HandlerWrapper.doStop()

checkSecurity

protected boolean checkSecurity(Request request)

isSessionRenewedOnAuthentication

public boolean isSessionRenewedOnAuthentication()
指定者:
接口 Authenticator.AuthConfiguration 中的 isSessionRenewedOnAuthentication
另请参见:
Authenticator.AuthConfiguration.isSessionRenewedOnAuthentication()

setSessionRenewedOnAuthentication

public void setSessionRenewedOnAuthentication(boolean renew)
Set renew the session on Authentication.

If set to true, then on authentication, the session associated with a reqeuest is invalidated and replaced with a new session.

另请参见:
Authenticator.AuthConfiguration.isSessionRenewedOnAuthentication()

handle

public void handle(String pathInContext,
                   Request baseRequest,
                   HttpServletRequest request,
                   HttpServletResponse response)
            throws IOException,
                   ServletException
从接口 Handler 复制的描述
Handle a request.

指定者:
接口 Handler 中的 handle
覆盖:
HandlerWrapper 中的 handle
参数:
pathInContext - The target of the request - either a URI or a name.
baseRequest - The original unwrapped request object.
request - The request either as the Request object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection() method can be used access the Request object if required.
response - The response as the Response object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection() method can be used access the Response object if required.
抛出:
IOException
ServletException

getCurrentSecurityHandler

public static SecurityHandler getCurrentSecurityHandler()

logout

public void logout(Authentication.User user)

prepareConstraintInfo

protected abstract Object prepareConstraintInfo(String pathInContext,
                                                Request request)

checkUserDataPermissions

protected abstract boolean checkUserDataPermissions(String pathInContext,
                                                    Request request,
                                                    Response response,
                                                    Object constraintInfo)
                                             throws IOException
抛出:
IOException

isAuthMandatory

protected abstract boolean isAuthMandatory(Request baseRequest,
                                           Response base_response,
                                           Object constraintInfo)

checkWebResourcePermissions

protected abstract boolean checkWebResourcePermissions(String pathInContext,
                                                       Request request,
                                                       Response response,
                                                       Object constraintInfo,
                                                       UserIdentity userIdentity)
                                                throws IOException
抛出:
IOException


Copyright © 2013. All Rights Reserved.