org.norther.tammi.spray.filter
Class AbstractSecureContainerFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer
          extended by org.norther.tammi.core.security.DefaultSecureContainer
              extended by org.norther.tammi.spray.filter.AbstractSecureContainerFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Container, Manageable, MBeanDelegate, AccessController, SecureContainer, ContainerFilter, SecureContainerFilter, SecureFilter
Direct Known Subclasses:
AbstractSecureContainerKeyFilter, DefaultSecureContainerFilter

public abstract class AbstractSecureContainerFilter
extends DefaultSecureContainer
implements SecureContainerFilter

An abstract implementation of SecureContainerFilter.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
AbstractSecureContainerFilter()
          Constructs a new filter.
AbstractSecureContainerFilter(String className)
          Constructs a new filter with a container class.
 
Method Summary
 boolean checkPermission(Permission permission, ServletRequest request, ServletResponse response, FilterChain chain)
          Checks whether or not the specified request has the specified permission.
 boolean checkPermission(String resource, int mask, ServletRequest request, ServletResponse response, FilterChain chain)
          Checks whether or not the specified request has a permission to access the masked actions of the specified resource.
 boolean checkPermission(String resource, String actions, ServletRequest request, ServletResponse response, FilterChain chain)
          Checks whether or not the specified request has a permission to access the named actions of the specified resource.
 void destroy()
           
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
protected abstract  Filter getFilter()
          Gets the filter adaptee.
 FilterConfig getFilterConfig()
          Gets the filter config of this filter.
 Map getRequestMap(ServletRequest request, int capacity)
          Gets a cached request map of this filter.
 ConcurrentMap getSessionMap(ServletRequest request, int capacity)
          Gets the cached session map of this filter.
 void init(FilterConfig config)
           
 
Methods inherited from class org.norther.tammi.core.security.DefaultSecureContainer
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from class org.norther.tammi.core.base.DefaultContainer
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanHandle, getMBeanHandles, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.base.Container
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 

Constructor Detail

AbstractSecureContainerFilter

public AbstractSecureContainerFilter()
Constructs a new filter.


AbstractSecureContainerFilter

public AbstractSecureContainerFilter(String className)
Constructs a new filter with a container class.

Parameters:
className - the container class name.
Method Detail

init

public void init(FilterConfig config)
          throws ServletException
Specified by:
init in interface Filter
Throws:
ServletException

destroy

public void destroy()
Specified by:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws ServletException,
                     IOException
Specified by:
doFilter in interface Filter
Throws:
ServletException
IOException

checkPermission

public boolean checkPermission(String resource,
                               String actions,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
Description copied from interface: SecureFilter
Checks whether or not the specified request has a permission to access the named actions of the specified resource.

Specified by:
checkPermission in interface SecureFilter
Parameters:
resource - the name of the resource to check.
actions - the name(s) of actions to access.
request - the authenticated request.
response - the corresponding response.
chain - the active filter chain.
Returns:
true if the request has the permission, false otherwise.

checkPermission

public boolean checkPermission(String resource,
                               int mask,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
Description copied from interface: SecureFilter
Checks whether or not the specified request has a permission to access the masked actions of the specified resource.

Specified by:
checkPermission in interface SecureFilter
Parameters:
resource - the name of the resource to check.
mask - a mask of actions to access.
request - the authenticated request.
response - the corresponding response.
chain - the active filter chain.
Returns:
true if the request has the permission, false otherwise.

checkPermission

public boolean checkPermission(Permission permission,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
Description copied from interface: SecureFilter
Checks whether or not the specified request has the specified permission. If it does, true is returned, otherwise false is returned. More specifically, this method checks whether the passed permission is implied by the allowed permissions, not implied by the denied permissions and the principal of the request has an appropriate role mapped to the corresponding permission.

If the access controller is not protected by any permissions, true is returned.

Specified by:
checkPermission in interface SecureFilter
Parameters:
permission - the permission to be checked for.
request - the authenticated request.
response - the corresponding response.
chain - the active filter chain.
Returns:
true if the request has the permission, false otherwise.

getFilterConfig

public FilterConfig getFilterConfig()
Gets the filter config of this filter.

Returns:
the filter config or null.

getSessionMap

public ConcurrentMap getSessionMap(ServletRequest request,
                                   int capacity)
Gets the cached session map of this filter.

Parameters:
request - the request.
capacity - creates a map of the specified capacity if >0.
Returns:
the session map or null.

getRequestMap

public Map getRequestMap(ServletRequest request,
                         int capacity)
Gets a cached request map of this filter.

Parameters:
request - the request.
capacity - creates a map of the specified capacity if >0.
Returns:
the request map or null.

getFilter

protected abstract Filter getFilter()
Gets the filter adaptee.

Returns:
the filter adaptee.


Copyright © 2004 The Norther Organization. All rights reserved.