public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
PortletRequest.isUserInRole(java.lang.String)
Constructor and Description |
---|
UserRoleAuthorizationInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected void |
handleNotAuthorized(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
Object handler)
Handle a request that is not authorized according to this interceptor.
|
boolean |
preHandle(javax.portlet.PortletRequest request,
javax.portlet.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.
|
afterActionCompletion, afterCompletion, afterEventCompletion, afterRenderCompletion, afterResourceCompletion, postHandleRender, postHandleResource, preHandleAction, preHandleEvent, preHandleRender, preHandleResource
public final boolean preHandle(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, Object handler) throws javax.portlet.PortletException, IOException
HandlerInterceptorAdapter
This implementation always returns true
.
preHandle
in class HandlerInterceptorAdapter
javax.portlet.PortletException
IOException
public final void setAuthorizedRoles(String... authorizedRoles)
authorizedRoles
- array of role namesprotected void handleNotAuthorized(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, Object handler) throws javax.portlet.PortletException, IOException
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 evaluationjavax.portlet.PortletException
- if there is an internal errorIOException
- in case of an I/O error when writing the responseCopyright © 2019 Liferay, Inc.. All rights reserved.