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

Subversion URL:
Revision 5870, 2.9 KB checked in by pjkersha, 12 years ago (diff)
  • added an SQLAlchemy based AX interface for the OpenID Provider
  • Modified the openid_dbinterface egg to enable creation of a unique OpenID identifier based on a given database user table key
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$'
11from import IdentityMapping
13class AXInterfaceError(Exception):
14    """Base class for Attribute Exchange Interface Errors"""
16class AXInterfaceConfigError(AXInterfaceError):
17    """Attribute Exchange Interface configuration error"""
19class MissingRequiredAttrs(AXInterfaceError):
20    """Raised by the AXInterface __call__ method if the Relying Party has
21    requested attributes that this OpenID Provider cannot or is unable to
22    release"""
24class AXInterfaceReloginRequired(AXInterfaceError):
25    """Raise from AXInterface.__call__ if re-login is required"""
27class AXInterface(object):
28    """Interface class for OpenID Provider to respond to Attribute Exchange
29    Requests from a Relying Party"""
31    userIdentifier2IdentityURI = IdentityMapping.userIdentifier2IdentityURI
32    identityUri2UserIdentifier = IdentityMapping.identityUri2UserIdentifier
34    def __init__(self, **cfg):
35        """Add custom settings from the OpenID Provider's
36        openid.provider.axResponseHandler.* settings contained in the host
37        Paste ini file
39        @type cfg: dict
40        @param cfg: dictionary of configuration parameters read in from
41        openid.provider.axinterface.* config settings.
42        @raise AXInterfaceConfigError: if settings are missing or incorrect"""
43        raise NotImplementedError()
45    def __call__(self, ax_req, ax_resp, authnInterface, authnCtx):
46        """Add the attributes to the ax_resp object requested in the ax_req
47        object.  If it is not possible to return them, raise
48        MissingRequiredAttrs error
50        @type ax_req:
51        @param ax_req: attribute exchange request object.  To find out what
52        attributes the Relying Party has requested for example, call
53        ax_req.getRequiredAttrs()
54        @type ax_resp:
55        @param ax_resp: attribute exchange response object.  This method should
56        update the settings in this object.  Use addValue and setValues methods
57        @type authnInterface: AbstractAuthNInterface
58        @param authnInterface: custom authentication interface set
59        at login.  See
60 for more
61        information
62        @type authnCtx: dict like
63        @param authnCtx: session containing authentication context information
64        such as username and OpenID user identifier URI snippet
65        """
66        raise NotImplementedError()
Note: See TracBrowser for help on using the repository browser.