springpython.security.intercept
index
/home/gturnquist/spring-python-1.1.x/src/springpython/security/intercept.py

Copyright 2006-2008 SpringSource (http://springsource.com), All Rights Reserved
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 
Modules
       
springpython.security.context.SecurityContextHolder
logging
re

 
Classes
       
__builtin__.object
AbstractSecurityInterceptor
MethodSecurityInterceptor(springpython.aop.MethodInterceptor, AbstractSecurityInterceptor)
InterceptorStatusToken
ObjectDefinitionSource
AbstractMethodDefinitionSource
MethodDefinitionMap
springpython.aop.MethodInterceptor(__builtin__.object)
MethodSecurityInterceptor(springpython.aop.MethodInterceptor, AbstractSecurityInterceptor)

 
class AbstractMethodDefinitionSource(ObjectDefinitionSource)
    Abstract implementation of ObjectDefinitionSource.
 
 
Method resolution order:
AbstractMethodDefinitionSource
ObjectDefinitionSource
__builtin__.object

Methods defined here:
get_attributes(self, obj)
lookupAttributes(self, method)

Methods inherited from ObjectDefinitionSource:
get_conf_attr_defs()
If available, all of the ConfigAttributeDefinitions defined by the implementing class.
supports(cls)
Indicates whether the ObjectDefinitionSource implementation is able to provide ConfigAttributeDefinitions for
the indicated secure object type.

Data descriptors inherited from ObjectDefinitionSource:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class AbstractSecurityInterceptor(__builtin__.object)
    Abstract class that implements security interception for secure objects.
 
It will implements the proper handling of secure object invocations, being:
 
   1. Obtain the Authentication object from the SecurityContextHolder.
   2. Determine if the request relates to a secured or public invocation by looking up the secure object request
      against the ObjectDefinitionSource.
   3. For an invocation that is secured (there is a ConfigAttributeDefinition for the secure object invocation):
         1. If either the Authentication.isAuthenticated() returns false, or the alwaysReauthenticate is true,
            authenticate the request against the configured AuthenticationManager. When authenticated, replace
            the Authentication object on the SecurityContextHolder with the returned value.
         2. Authorize the request against the configured AccessDecisionManager.
         (3. Perform any run-as replacement via the configured RunAsManager. FUTURE)
         4. Pass control back to the concrete subclass, which will actually proceed with executing the object.
            An InterceptorStatusToken is returned so that after the subclass has finished proceeding with execution
            of the object, its finally clause can ensure the AbstractSecurityInterceptor is re-called and tidies up
            correctly.
         5. The concrete subclass will re-call the AbstractSecurityInterceptor via the after_invocation(InterceptorStatusToken, Object) method.
         (6. If the RunAsManager replaced the Authentication object, return the SecurityContextHolder to the object
            that existed after the call to AuthenticationManager. FUTURE)
         7. If an AfterInvocationManager is defined, invoke the invocation manager and allow it to replace the object
            due to be returned to the caller.
   (4. For an invocation that is public (there is no ConfigAttributeDefinition for the secure object invocation):
         1. As described above, the concrete subclass will be returned an InterceptorStatusToken which is subsequently
            re-presented to the AbstractSecurityInterceptor after the secure object has been executed. The
            AbstractSecurityInterceptor will take no further action when its after_invocation(InterceptorStatusToken, Object)
            is called. FUTURE)
   5. Control again returns to the concrete subclass, along with the Object that should be returned to the caller. The
      subclass will then return that result or exception to the original caller.
 
  Methods defined here:
__init__(self, auth_manager=None, access_decision_mgr=None, obj_def_source=None)
after_invocation(self, token, results)
As a minimum, this needs to pass the results right on through. Subclasses can extend this behavior
to utilize the token information.
before_invocation(self, invocation)
obtain_obj_def_source(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class InterceptorStatusToken(__builtin__.object)
    A return object received by AbstractSecurityInterceptor subclasses.
 
This class reflects the status of the security interception, so that the final call to
AbstractSecurityInterceptor.after_invocation(InterceptorStatusToken, Object) can tidy up correctly.
 
  Methods defined here:
__init__(self, authentication=None, attr=None, secure_obj=None)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MethodDefinitionMap(AbstractMethodDefinitionSource)
    Stores an obj_def_source for each method signature defined in a object.
 
Regular expressions are used to match a method request in a ConfigAttributeDefinition. The order of registering
the regular expressions is very important. The system will identify the first matching regular expression for a given
method. It will not proceed to evaluate later regular expressions if a match has already been found.
 
Accordingly, the most specific regular expressions should be registered first, with the most general regular expressions registered last.
 
 
Method resolution order:
MethodDefinitionMap
AbstractMethodDefinitionSource
ObjectDefinitionSource
__builtin__.object

Methods defined here:
__init__(self, obj_def_source)
lookupAttributes(self, method)

Methods inherited from AbstractMethodDefinitionSource:
get_attributes(self, obj)

Methods inherited from ObjectDefinitionSource:
get_conf_attr_defs()
If available, all of the ConfigAttributeDefinitions defined by the implementing class.
supports(cls)
Indicates whether the ObjectDefinitionSource implementation is able to provide ConfigAttributeDefinitions for
the indicated secure object type.

Data descriptors inherited from ObjectDefinitionSource:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MethodSecurityInterceptor(springpython.aop.MethodInterceptor, AbstractSecurityInterceptor)
    Provides security interception of Spring Python AOP-based method invocations.
 
The ObjectDefinitionSource required by this security interceptor is of type MethodDefinitionMap.
 
Refer to AbstractSecurityInterceptor for details on the workflow.
 
 
Method resolution order:
MethodSecurityInterceptor
springpython.aop.MethodInterceptor
AbstractSecurityInterceptor
__builtin__.object

Methods defined here:
__init__(self)
__setattr__(self, name, value)
invoke(self, invocation)
obtain_obj_def_source(self)

Data descriptors inherited from springpython.aop.MethodInterceptor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from AbstractSecurityInterceptor:
after_invocation(self, token, results)
As a minimum, this needs to pass the results right on through. Subclasses can extend this behavior
to utilize the token information.
before_invocation(self, invocation)

 
class ObjectDefinitionSource(__builtin__.object)
    Implemented by classes that store and can identify the ConfigAttributeDefinition that applies to a given secure object invocation.
 
  Methods defined here:
get_attributes(obj)
Accesses the ConfigAttributeDefinition that applies to a given secure object.
get_conf_attr_defs()
If available, all of the ConfigAttributeDefinitions defined by the implementing class.
supports(cls)
Indicates whether the ObjectDefinitionSource implementation is able to provide ConfigAttributeDefinitions for
the indicated secure object type.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        logger = <logging.Logger instance>