source: TI12-security/trunk/python/ndg_security_server/ndg/security/server/wsgi/openid/provider/axinterface/ @ 5782

Subversion URL:
Revision 5782, 2.6 KB checked in by pjkersha, 12 years ago (diff)

Re-testing OpenID Attribute Exchange interface - added CSV file based test AX Response class.

1"""WSGI Middleware components - OpenID Provider package Attribute Exchange
2Interface plugins sub-package
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__ = ""
10__revision__ = '$Id$'
12class AXInterfaceError(Exception):
13    """Base class for Attribute Exchange Interface Errors"""
15class AXInterfaceConfigError(AXInterfaceError):
16    """Attribute Exchange Interface configuration error"""
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"""
23class AXInterfaceReloginRequired(AXInterfaceError):
24    """Raise from AXInterface.__call__ if re-login is required"""
26class AXInterface(object):
27    """Interface class for OpenID Provider to respond to Attribute Exchange
28    Requests from a Relying Party"""
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
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()
41    def __call__(self, ax_req, ax_resp, authnInterface, authnCtx):
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
46        @type ax_req:
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:
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 authnInterface: AbstractAuthNInterface
54        @param authnInterface: custom authentication interface set
55        at login.  See
56 for more
57        information
58        @type authnCtx: dict like
59        @param authnCtx: session containing authentication context information
60        such as username and OpenID user identifier URI snippet
61        """
62        raise NotImplementedError()
Note: See TracBrowser for help on using the repository browser.