public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
javax.portlet.PortletRequest#isUserInRole
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
authorizedRoles |
Constructor and Description |
---|
UserRoleAuthorizationInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected void |
handleNotAuthorized(PortletRequest request,
PortletResponse response,
java.lang.Object handler)
Handle a request that is not authorized according to this interceptor.
|
boolean |
preHandle(PortletRequest request,
PortletResponse response,
java.lang.Object handler)
Default callback that all "pre*" methods delegate to.
|
void |
setAuthorizedRoles(java.lang.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 void setAuthorizedRoles(java.lang.String... authorizedRoles)
authorizedRoles
- array of role namespublic final boolean preHandle(PortletRequest request, PortletResponse response, java.lang.Object handler) throws PortletException, java.io.IOException
HandlerInterceptorAdapter
This implementation always returns true
.
preHandle
in class HandlerInterceptorAdapter
PortletException
java.io.IOException
protected void handleNotAuthorized(PortletRequest request, PortletResponse response, java.lang.Object handler) throws PortletException, java.io.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 errorjava.io.IOException
- in case of an I/O error when writing the responsePortletException