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

Class TrustRoot

source code

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.

Instance Methods
bool
isSane(self)
This method checks the to see if a trust root represents a reasonable (sane) set of URLs.
source code
 
__init__(self, unparsed, proto, wildcard, host, port, path)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
bool
validateURL(self, url)
Validates a URL against this trust root.
source code
str
buildDiscoveryURL(self)
Return a discovery URL for this realm.
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code

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

Class Methods
NoneType or TrustRoot
parse(cls, trust_root)
This method creates a TrustRoot instance from the given input, if possible.
source code
 
checkSanity(cls, trust_root_string)
str -> bool
source code
 
checkURL(cls, trust_root, url)
quick func for validating a url against a trust root.
source code
Properties

Inherited from object: __class__

Method Details

parse(cls, trust_root)
Class Method

source code 

This method creates a TrustRoot instance from the given input, if possible.

Parameters:
  • trust_root (str) - This is the trust root to parse into a TrustRoot object.
Returns: NoneType or TrustRoot
A TrustRoot instance if trust_root parses as a trust root, None otherwise.

isSane(self)

source code 

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: bool
Whether the trust root is sane

__init__(self, unparsed, proto, wildcard, host, port, path)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

validateURL(self, url)

source code 

Validates a URL against this trust root.

Parameters:
  • url (str) - The URL to check
Returns: bool
Whether the given URL is within this trust root.

checkSanity(cls, trust_root_string)
Class Method

source code 

str -> bool

is this a sane trust root?

checkURL(cls, trust_root, url)
Class Method

source code 

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

buildDiscoveryURL(self)

source code 

Return a discovery URL for this realm.

This function does not check to make sure that the realm is valid. Its behaviour on invalid inputs is undefined.

Returns: str
The URL upon which relying party discovery should be run in order to verify the return_to URL

Since: 2.1.0

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)