Package openid :: Package server :: Module server :: Class CheckIDRequest
[frames] | no frames]

Class CheckIDRequest

source code

   object --+    
            |    
OpenIDRequest --+
                |
               CheckIDRequest

A request to confirm the identity of a user.

This class handles requests for openid modes checkid_immediate and checkid_setup.

Instance Methods
 
__init__(self, identity, return_to, trust_root=None, immediate=False, assoc_handle=None, op_endpoint=None, claimed_id=None)
Construct me.
source code
bool
idSelect(self)
Is the identifier to be selected by the IDP?
source code
bool
trustRootValid(self)
Is my return_to under my trust_root?
source code
bool
returnToVerified(self)
Does the relying party publish the return_to URL for this response under the realm? It is up to the provider to set a policy for what kinds of realms should be allowed.
source code
OpenIDResponse
answer(self, allow, server_url=None, identity=None, claimed_id=None)
Respond to this request.
source code
str
encodeToURL(self, server_url)
Encode this request as a URL to GET.
source code
str
getCancelURL(self)
Get the URL to cancel this request.
source code
 
__repr__(self)
repr(x)
source code

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

Class Methods
CheckIDRequest
fromMessage(klass, message, op_endpoint)
Construct me from an OpenID message.
source code
Class Variables
str mode
the openid.mode of this request.
Instance Variables
str assoc_handle
Provided in smart mode requests, a handle for a previously established association.
str claimed_id
The claimed identifier.
str identity
The OP-local identifier being checked.
bool immediate
Is this an immediate-mode request?
str return_to
The URL to send the user agent back to to reply to this request.
str trust_root
"Are you Frank?" asks the checkid request.
Properties
  namespace

Inherited from object: __class__

Method Details

__init__(self, identity, return_to, trust_root=None, immediate=False, assoc_handle=None, op_endpoint=None, claimed_id=None)
(Constructor)

source code 

Construct me.

These parameters are assigned directly as class attributes, see my class documentation for their descriptions.

Raises:
Overrides: object.__init__

fromMessage(klass, message, op_endpoint)
Class Method

source code 

Construct me from an OpenID message.

Parameters:
  • message (openid.message.Message) - An OpenID checkid_* request Message
  • op_endpoint (str) - The endpoint URL of the server that this message was sent to.
Returns: CheckIDRequest
Raises:

returnToVerified(self)

source code 

Does the relying party publish the return_to URL for this response under the realm? It is up to the provider to set a policy for what kinds of realms should be allowed. This return_to URL verification reduces vulnerability to data-theft attacks based on open proxies, cross-site-scripting, or open redirectors.

This check should only be performed after making sure that the return_to URL matches the realm.

Returns: bool
True if the realm publishes a document with the return_to URL listed
Raises:

See Also: trustRootValid

Since: 2.1.0

answer(self, allow, server_url=None, identity=None, claimed_id=None)

source code 

Respond to this request.

Parameters:
  • allow (bool) - Allow this user to claim this identity, and allow the consumer to have this information?
  • server_url (str) - DEPRECATED. Passing op_endpoint to the Server constructor makes this optional.

    When an OpenID 1.x immediate mode request does not succeed, it gets back a URL where the request may be carried out in a not-so-immediate fashion. Pass my URL in here (the fully qualified address of this server's endpoint, i.e. http://example.com/server), and I will use it as a base for the URL for a new request.

    Optional for requests where CheckIDRequest.immediate is False or allow is True.

  • identity (str or None) - The OP-local identifier to answer with. Only for use when the relying party requested identifier selection.
  • claimed_id (str or None) - The claimed identifier to answer with, for use with identifier selection in the case where the claimed identifier and the OP-local identifier differ, i.e. when the claimed_id uses delegation.

    If identity is provided but this is not, claimed_id will default to the value of identity. When answering requests that did not ask for identifier selection, the response claimed_id will default to that of the request.

    This parameter is new in OpenID 2.0.

Returns: OpenIDResponse
Raises:
  • NoReturnError - when I do not have a return_to.

Change Log: Version 2.0 deprecates server_url and adds claimed_id.

encodeToURL(self, server_url)

source code 

Encode this request as a URL to GET.

Parameters:
  • server_url (str) - The URL of the OpenID server to make this request of.
Returns: str
Raises:
  • NoReturnError - when I do not have a return_to.

getCancelURL(self)

source code 

Get the URL to cancel this request.

Useful for creating a "Cancel" button on a web form so that operation can be carried out directly without another trip through the server.

(Except you probably want to make another trip through the server so that it knows that the user did make a decision. Or you could simulate this method by doing .answer(False).encodeToURL())

Returns: str
The return_to URL with openid.mode = cancel.
Raises:
  • NoReturnError - when I do not have a return_to.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Instance Variable Details

assoc_handle

Provided in smart mode requests, a handle for a previously established association. None for dumb mode requests.
Type:
str

claimed_id

The claimed identifier. Not present in OpenID 1.x messages.
Type:
str

trust_root

"Are you Frank?" asks the checkid request. "Who wants to know?" trust_root, that's who. This URL identifies the party making the request, and the user will use that to make her decision about what answer she trusts them to have. Referred to as "realm" in OpenID 2.0.
Type:
str

Property Details

namespace

Get Method:
_getNamespace(self)