类 UserRoleAuthorizationInterceptor
- java.lang.Object
- org.springframework.web.portlet.handler.HandlerInterceptorAdapter
- org.springframework.web.portlet.handler.UserRoleAuthorizationInterceptor
- 所有已实现的接口:
HandlerInterceptor
public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
Interceptor that checks the authorization of the current user via the user's roles, as evaluated by PortletRequest's isUserInRole method.- 从以下版本开始:
- 2.0
- 作者:
- John A. Lewis, Juergen Hoeller
- 另请参阅:
PortletRequest.isUserInRole(java.lang.String)
构造器概要
构造器 构造器 说明 UserRoleAuthorizationInterceptor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
handleNotAuthorized(PortletRequest request, PortletResponse response, Object handler)
Handle a request that is not authorized according to this interceptor.boolean
preHandle(PortletRequest request, PortletResponse response, Object handler)
Default callback that all "pre*" methods delegate to.void
setAuthorizedRoles(String... authorizedRoles)
Set the roles that this interceptor should treat as authorized.从类继承的方法 org.springframework.web.portlet.handler.HandlerInterceptorAdapter
afterActionCompletion, afterCompletion, afterEventCompletion, afterRenderCompletion, afterResourceCompletion, postHandleRender, postHandleResource, preHandleAction, preHandleEvent, preHandleRender, preHandleResource
构造器详细资料
UserRoleAuthorizationInterceptor
public UserRoleAuthorizationInterceptor()
方法详细资料
setAuthorizedRoles
public final void setAuthorizedRoles(String... authorizedRoles)
Set the roles that this interceptor should treat as authorized.- 参数:
authorizedRoles
- array of role names
preHandle
public final boolean preHandle(PortletRequest request, PortletResponse response, Object handler) throws PortletException, IOException
从类复制的说明:HandlerInterceptorAdapter
Default callback that all "pre*" methods delegate to.This implementation always returns
true
.
handleNotAuthorized
protected void handleNotAuthorized(PortletRequest request, PortletResponse response, Object handler) throws PortletException, IOException
Handle a request that is not authorized according to this interceptor. Default implementation throws a new PortletSecurityException.This method can be overridden to write a custom message, forward or redirect to some error page or login page, or throw a PortletException.
- 参数:
request
- current portlet requestresponse
- current portlet responsehandler
- chosen handler to execute, for type and/or instance evaluation- 抛出:
PortletException
- if there is an internal errorIOException
- in case of an I/O error when writing the response