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.
  addSignature(self, fields, data, prefix)
  checkSignature(self, data, prefix)
  deserialize(cls, assoc_s)
Parse an association as stored by serialize(). (Class method)
str serialize(self)
Convert an association to KV form.
str sign(self, pairs)
Generate a signature for a sequence of (key, value) pairs
str signDict(self, fields, data, prefix)
Generate a signature for some fields in a dictionary
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __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', '...
int SIG_LENGTH = 20                                                                    

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)

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)

signDict(self, fields, data, prefix='openid.')

Generate a signature for some fields in a dictionary
Parameters:
fields - The fields to sign, in order
           (type=sequence of str)
data - Dictionary of values to sign
           (type={str:str})
Returns:
the signature, base64 encoded
           (type=str)

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']    

SIG_LENGTH

Type:
int
Value:
20                                                                    

Generated by Epydoc 2.1 on Mon Jun 11 13:59:41 2007 http://epydoc.sf.net