Package openid :: Package consumer :: Module consumer :: Class Consumer
[frames] | no frames]

Class Consumer

source code

object --+
         |
        Consumer

An OpenID consumer implementation that performs discovery and does session management.

Instance Methods [hide private]
  __init__(self, session, store)
Initialize a Consumer instance.
AuthRequest begin(self, user_url)
Start the OpenID authentication process.
AuthRequest beginWithoutDiscovery(self, service)
Start OpenID verification without doing OpenID server discovery.
  complete(self, query)
Called to interpret the server's response to an OpenID request.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
  session_key_prefix = '_openid_consumer_'
A string that is prepended to session keys to ensure that they are unique.

Instance Variables [hide private]
GenericConsumer consumer
an instance of an object implementing the OpenID protocol, but doing no discovery or session management.
  session
A dictionary-like object representing the user's session data.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, session, store)
(Constructor)

source code 

Initialize a Consumer instance.

You should create a new instance of the Consumer object with every HTTP request that handles OpenID transactions.
Parameters:
Overrides: object.__init__
See Also:
openid.store.interface, openid.store

begin(self, user_url)

source code 

Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file.
Parameters:
  • user_url (str) - Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. For example, a user_url of example.com will be normalized to http://example.com/ normalizing and resolving any redirects the server might issue.
Returns: AuthRequest
An object containing the discovered information will be returned, with a method for building a redirect URL to the server, as described in step 3 of the overview. This object may also be used to add extension arguments to the request, using its addExtensionArg method.
Raises:
  • openid.consumer.discover.DiscoveryFailure - when I fail to find an OpenID server for this URL. If the yadis package is available, openid.consumer.discover.DiscoveryFailure is an alias for yadis.discover.DiscoveryFailure.

beginWithoutDiscovery(self, service)

source code 

Start OpenID verification without doing OpenID server discovery. This method is used internally by Consumer.begin after discovery is performed, and exists to provide an interface for library users needing to perform their own discovery.
Parameters:
Returns: AuthRequest
an OpenID authentication request object.
See Also:
Openid.consumer.consumer.Consumer.begin, openid.consumer.discover

complete(self, query)

source code 

Called to interpret the server's response to an OpenID request. It is called in step 4 of the flow described in the consumer overview.
Parameters:
  • query - A dictionary of the query parameters for this HTTP request.
Returns:
a subclass of Response. The type of response is indicated by the status attribute, which will be one of SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED.
See Also:
SuccessResponse, CancelResponse, SetupNeededResponse, FailureResponse

Class Variable Details [hide private]

session_key_prefix


A string that is prepended to session keys to ensure that they are unique. This variable may be changed to suit your application.
Value:
'_openid_consumer_'                                                    
      

Instance Variable Details [hide private]

consumer


an instance of an object implementing the OpenID protocol, but doing no discovery or session management.
Type:
GenericConsumer

session


A dictionary-like object representing the user's session data. This is used for keeping state of the OpenID transaction when the user is redirected to the server.