Package openid :: Module association :: Class Association
[frames | no frames]

Type Association

object --+
         |
        Association


This class represents an association between a server and a consumer. In general, users of this library will never see instances of this object. The only exception is if you implement a custom OpenIDStore.

If you do implement such a store, it will need to store the values of the handle, secret, issued, lifetime, and assoc_type instance variables.
Method Summary
  __init__(self, handle, secret, issued, lifetime, assoc_type)
This is the standard constructor for creating an association.
  fromExpiresIn(cls, expires_in, handle, secret, assoc_type)
This is an alternate constructor used by the OpenID consumer library to create associations. (Class method)
int getExpiresIn(self, now)
This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
bool __eq__(self, other)
This checks to see if two Association instances represent the same association.
bool __ne__(self, other)
This checks to see if two Association instances represent different associations.
  __repr__(self)
  checkMessageSignature(self, message)
Given a message with a signature, calculate a new signature and return whether it matches the signature in the message.
  deserialize(cls, assoc_s)
Parse an association as stored by serialize(). (Class method)
str getMessageSignature(self, message)
Return the signature of a message.
str serialize(self)
Convert an association to KV form.
str sign(self, pairs)
Generate a signature for a sequence of (key, value) pairs
openid.message.Message signMessage(self, message)
Add a signature (and a signed list) to a message.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Property Summary
  expiresIn: This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.

Instance Variable Summary
str handle: This is the handle the server gave this association.
str secret: This is the shared secret the server generated for this association.
int issued: This is the time this association was issued, in seconds since 00:00 GMT, January 1, 1970.
int lifetime: This is the amount of time this association is good for, measured in seconds since the association was issued.
str assoc_type: This is the type of association this instance represents.

Class Variable Summary
list assoc_keys = ['version', 'handle', 'secret', 'issued', '...

Instance Method Details

__init__(self, handle, secret, issued, lifetime, assoc_type)
(Constructor)

This is the standard constructor for creating an association.
Parameters:
handle - This is the handle the server gave this association.
           (type=str)
secret - This is the shared secret the server generated for this association.
           (type=str)
issued - This is the time this association was issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a unix timestamp)
           (type=int)
lifetime - This is the amount of time this association is good for, measured in seconds since the association was issued.
           (type=int)
assoc_type - This is the type of association this instance represents. The only valid value of this field at this time is 'HMAC-SHA1', but new types may be defined in the future.
           (type=str)
Overrides:
__builtin__.object.__init__

getExpiresIn(self, now=None)

This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
Returns:
The number of seconds this association is still valid for, or 0 if the association is no longer valid.
           (type=int)

__eq__(self, other)
(Equality operator)

This checks to see if two Association instances represent the same association.
Returns:
True if the two instances represent the same association, False otherwise.
           (type=bool)

__ne__(self, other)

This checks to see if two Association instances represent different associations.
Returns:
True if the two instances represent different associations, False otherwise.
           (type=bool)

checkMessageSignature(self, message)

Given a message with a signature, calculate a new signature and return whether it matches the signature in the message.
Raises:
ValueError - if the message has no signature or no signature can be calculated for it.

getMessageSignature(self, message)

Return the signature of a message.

If I am not a sign-all association, the message must have a signed list.
Returns:
the signature, base64 encoded
           (type=str)
Raises:
ValueError - If there is no signed list and I am not a sign-all type of association.

serialize(self)

Convert an association to KV form.
Returns:
String in KV form suitable for deserialization by deserialize.
           (type=str)

sign(self, pairs)

Generate a signature for a sequence of (key, value) pairs
Parameters:
pairs - The pairs to sign, in order
           (type=sequence of (str, str))
Returns:
The binary signature of this sequence of pairs
           (type=str)

signMessage(self, message)

Add a signature (and a signed list) to a message.
Returns:
a new Message object with a signature
           (type=openid.message.Message)

Class Method Details

fromExpiresIn(cls, expires_in, handle, secret, assoc_type)

This is an alternate constructor used by the OpenID consumer library to create associations. OpenIDStore implementations shouldn't use this constructor.
Parameters:
expires_in - This is the amount of time this association is good for, measured in seconds since the association was issued.
           (type=int)
handle - This is the handle the server gave this association.
           (type=str)
secret - This is the shared secret the server generated for this association.
           (type=str)
assoc_type - This is the type of association this instance represents. The only valid value of this field at this time is 'HMAC-SHA1', but new types may be defined in the future.
           (type=str)

deserialize(cls, assoc_s)

Parse an association as stored by serialize().

inverse of serialize
Parameters:
assoc_s - Association as serialized by serialize()
           (type=str)
Returns:
instance of this class

Property Details

expiresIn

This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
Get Method:
getExpiresIn(self, now)

Instance Variable Details

handle

This is the handle the server gave this association.
Type:
str

secret

This is the shared secret the server generated for this association.
Type:
str

issued

This is the time this association was issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a unix timestamp)
Type:
int

lifetime

This is the amount of time this association is good for, measured in seconds since the association was issued.
Type:
int

assoc_type

This is the type of association this instance represents. The only valid value of this field at this time is 'HMAC-SHA1', but new types may be defined in the future.
Type:
str

Class Variable Details

assoc_keys

Type:
list
Value:
['version', 'handle', 'secret', 'issued', 'lifetime', 'assoc_type']    

Generated by Epydoc 2.1 on Fri Jun 6 15:54:34 2008 http://epydoc.sf.net