source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/handler.py @ 7064

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/handler.py@7064
Revision 7064, 1.7 KB checked in by pjkersha, 9 years ago (diff)

Incomplete - task 2: XACML-Security Integration

  • added and and function and placeholders fro xpath-node-* functions
  • Property svn:keywords set to Id
Line 
1"""NDG Security Context handler definition
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "24/02/10"
7__copyright__ = "(C) 2010 Science and Technology Facilities Council"
8__contact__ = "Philip.Kershaw@stfc.ac.uk"
9__license__ = "BSD - see LICENSE file in top-level directory"
10__contact__ = "Philip.Kershaw@stfc.ac.uk"
11__revision__ = "$Id$"
12from abc import ABCMeta, abstractmethod
13from ndg.xacml.core.context.pdpinterface import PDPInterface
14
15
16class PEPInterface(object):
17    """Policy Enforcement Point Interface"""
18    __metaclass__ = ABCMeta
19    __slots__ = ()
20   
21    @classmethod
22    def __subclasshook__(cls, C):
23        """Derived class must implement __call__"""
24        if cls is PEPInterface:
25            if any("handlePEPRequest" in B.__dict__ for B in C.__mro__):
26                return True
27           
28        return NotImplemented
29       
30    @abstractmethod
31    def handlePEPRequest(self, pepRequest):
32        """Handle request from Policy Enforcement Point
33       
34        @param pepRequest: request from PEP, derived class determines its type
35        e.g. SAML AuthzDecisionQuery
36        @type pepRequest: type
37        @return: PEP response - derived class determines type
38        @rtype: None
39        """
40        raise NotImplementedError()
41       
42       
43class CtxHandlerInterface(PEPInterface):
44    """Context Handler interface."""
45    __metaclass__ = ABCMeta
46    __slots__ = ()
47   
48    def pepQuery(self, request, designator):
49        """Query a Policy Information Point to retrieve the attribute values
50        corresponding to the specified input designator.  Optionally, update the
51        requestCtx.  This could be a subject, environment or resource.  Matching
52        attributes values are returned
53        """
54        return []
55       
Note: See TracBrowser for help on using the repository browser.