source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/pdp.py @ 6771

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/pdp.py@6771
Revision 6771, 1.4 KB checked in by pjkersha, 11 years ago (diff)

Added request subject, resource, action and environment types

Line 
1"""NDG Security Policy Decision Point type definition
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "25/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.request import Request
14
15
16class PDPInterface:
17    __metaclass__ = ABCmeta
18   
19    @classmethod
20    def __subclasshook__(cls, C):
21        """Derived class must implement __call__"""
22        if cls is PDPInterface:
23            if any("evaluate" in B.__dict__ for B in C.__mro__):
24                return True
25           
26        return NotImplemented
27
28    @abstractmethod
29    def evaluate(self, request):
30        '''evaluate the input request and return an access control decision
31        in the returned response
32       
33        @param request: XACML context request
34        @type request: ndg.xacml.core.context.request.Request
35        @return: XACML context response
36        @rtype: ndg.xacml.core.context.response.Response
37        '''
38        if not isinstance(request, Request):
39            raise TypeError('Expecting %r type for input request; got %r '
40                            'instead' % (Request, type(request))
41                           
42
Note: See TracBrowser for help on using the repository browser.