Package openid :: Package server :: Module trustroot :: Class TrustRoot
[frames | no frames]

Type TrustRoot

object --+
         |
        TrustRoot


This class represents an OpenID trust root. The parse classmethod accepts a trust root string, producing a TrustRoot object. The method OpenID server implementers would be most likely to use is the isSane method, which checks the trust root for given patterns that indicate that the trust root is too broad or points to a local network resource.
Method Summary
NoneType or TrustRoot parse(cls, trust_root)
This method creates a TrustRoot instance from the given input, if possible. (Class method)
bool isSane(self)
This method checks the to see if a trust root represents a reasonable (sane) set of URLs.
  __init__(self, unparsed, proto, wildcard, host, port, path)
  __repr__(self)
  __str__(self)
  checkSanity(cls, trust_root_string)
str -> bool (Class method)
  checkURL(cls, trust_root, url)
quick func for validating a url against a trust root. (Class method)
bool validateURL(self, url)
Validates a URL against this trust root.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Instance Method Details

isSane(self)

This method checks the to see if a trust root represents a reasonable (sane) set of URLs. 'http://*.com/', for example is not a reasonable pattern, as it cannot meaningfully specify the site claiming it. This function attempts to find many related examples, but it can only work via heuristics. Negative responses from this method should be treated as advisory, used only to alert the user to examine the trust root carefully.
Returns:
Whether the trust root is sane
           (type=bool)

validateURL(self, url)

Validates a URL against this trust root.
Parameters:
url - The URL to check
           (type=str)
Returns:
Whether the given URL is within this trust root.
           (type=bool)

Class Method Details

parse(cls, trust_root)

This method creates a TrustRoot instance from the given input, if possible.
Parameters:
trust_root - This is the trust root to parse into a TrustRoot object.
           (type=str)
Returns:
A TrustRoot instance if trust_root parses as a trust root, None otherwise.
           (type=NoneType or TrustRoot)

checkSanity(cls, trust_root_string)

str -> bool

is this a sane trust root?

checkURL(cls, trust_root, url)

quick func for validating a url against a trust root. See the TrustRoot class if you need more control.

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