Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/pdp.py@6775
Revision 6775,
1.4 KB
checked in by pjkersha, 11 years ago
(diff) |
More work on PDP and moved pdp, pip and pap modules to context package.
|
Line | |
---|
1 | """NDG Security Policy Decision Point type definition |
---|
2 | |
---|
3 | NERC 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: $" |
---|
12 | from abc import ABCMeta, abstractmethod |
---|
13 | from ndg.xacml.core.context.request import Request |
---|
14 | |
---|
15 | |
---|
16 | class 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.