source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/wsgi/openid/provider/axinterface/__init__.py @ 5285

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/wsgi/openid/provider/axinterface/__init__.py@5285
Revision 5285, 2.5 KB checked in by pjkersha, 11 years ago (diff)
  • Important fixes to PDP.evaluate to ensure all targets yield permit status for an access control decision.
  • additional debug info for WSGI middleware
  • new OpenID Provider AXInterfaceReloginRequired - allows for case where a session is stale
  • ndg.security.test.unit - put unit tests in this package in parallel to the existing integration test package.
Line 
1"""WSGI Middleware components - OpenID Provider package Attribute Exchange
2Interface plugins sub-package
3
4NERC DataGrid Project"""
5__author__ = "P J Kershaw"
6__date__ = "27/03/09"
7__copyright__ = "(C) 2009 Science and Technology Facilities Council"
8__license__ = "BSD - see LICENSE file in top-level directory"
9__contact__ = "Philip.Kershaw@stfc.ac.uk"
10__revision__ = '$Id$'
11
12class AXInterfaceError(Exception):
13    """Base class for Attribute Exchange Interface Errors"""
14
15class AXInterfaceConfigError(AXInterfaceError):
16    """Attribute Exchange Interface configuration error"""
17
18class MissingRequiredAttrs(AXInterfaceError):
19    """Raised by the AXInterface __call__ method if the Relying Party has
20    requested attributes that this OpenID Provider cannot or is unable to
21    release"""
22
23class AXInterfaceReloginRequired(AXInterfaceError):
24    """Raise from AXInterface.__call__ if re-login is required"""
25   
26class AXInterface(object):
27    """Interface class for OpenID Provider to respond to Attribute Exchange
28    Requests from a Relying Party"""
29   
30    def __init__(self, **cfg):
31        """Add custom settings from the OpenID Provider's
32        openid.provider.axResponseHandler.* settings contained in the host
33        Paste ini file
34       
35        @type cfg: dict
36        @param cfg: dictionary of configuration parameters read in from
37        openid.provider.axinterface.* config settings.
38        @raise AXInterfaceConfigError: if settings are missing or incorrect"""
39        raise NotImplementedError()
40   
41    def __call__(self, ax_req, ax_resp, authNInterface):
42        """Add the attributes to the ax_resp object requested in the ax_req
43        object.  If it is not possible to return them, raise
44        MissingRequiredAttrs error
45       
46        @type ax_req: openid.extensions.ax.FetchRequest
47        @param ax_req: attribute exchange request object.  To find out what
48        attributes the Relying Party has requested for example, call
49        ax_req.getRequiredAttrs()
50        @type ax_resp: openid.extensions.ax.FetchResponse
51        @param ax_resp: attribute exchange response object.  This method should
52        update the settings in this object.  Use addValue and setValues methods
53        @type authNInterfaceCtx: AbstractAuthNInterface
54        @param authNInterfaceCtx: custom authentication interface set
55        at login.  See
56        ndg.security.server.openid.provider.AbstractAuthNInterface for more
57        information
58        """
59        raise NotImplementedError()
Note: See TracBrowser for help on using the repository browser.