public class

UserRoleAuthorizationInterceptor

extends HandlerInterceptorAdapter
java.lang.Object
   ↳ org.springframework.web.portlet.handler.HandlerInterceptorAdapter
     ↳ org.springframework.web.portlet.handler.UserRoleAuthorizationInterceptor

Class Overview

Interceptor that checks the authorization of the current user via the user's roles, as evaluated by PortletRequest's isUserInRole method.

See Also
  • javax.portlet.PortletRequest#isUserInRole

Summary

Public Constructors
UserRoleAuthorizationInterceptor()
Public Methods
final boolean preHandle(PortletRequest request, PortletResponse response, Object handler)
Default callback that all "pre*" methods delegate to.
final void setAuthorizedRoles(String[] authorizedRoles)
Set the roles that this interceptor should treat as authorized.
Protected Methods
void handleNotAuthorized(PortletRequest request, PortletResponse response, Object handler)
Handle a request that is not authorized according to this interceptor.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.handler.HandlerInterceptorAdapter
From class java.lang.Object
From interface org.springframework.web.portlet.HandlerInterceptor

Public Constructors

public UserRoleAuthorizationInterceptor ()

Public Methods

public final boolean preHandle (PortletRequest request, PortletResponse response, Object handler)

Default callback that all "pre*" methods delegate to.

This implementation always returns true.

Throws
IOException
PortletException

public final void setAuthorizedRoles (String[] authorizedRoles)

Set the roles that this interceptor should treat as authorized.

Parameters
authorizedRoles array of role names

Protected Methods

protected void handleNotAuthorized (PortletRequest request, PortletResponse response, Object handler)

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.

Parameters
request current portlet request
response current portlet response
handler chosen handler to execute, for type and/or instance evaluation
Throws
if there is an internal error
IOException in case of an I/O error when writing the response
PortletException