Package openid :: Package server :: Module trustroot
[hide private]
[frames] | no frames]

Module trustroot

source code

This module contains the TrustRoot class, which helps handle trust root checking. This module is used by the openid.server.server module, but it is also available to server implementers who wish to use it for additional trust root checking.

It also implements relying party return_to URL verification, based on the realm.

Classes [hide private]
  RealmVerificationRedirected
Attempting to verify this realm resulted in a redirect.
  TrustRoot
This class represents an OpenID trust root.
Functions [hide private]
 
_parseURL(url) source code
str or NoneType
_extractReturnURL(endpoint)
If the endpoint is a relying party OpenID return_to endpoint, return the endpoint URL.
source code
 
returnToMatches(allowed_return_to_urls, return_to)
Is the return_to URL under one of the supplied allowed return_to URLs?
source code
 
getAllowedReturnURLs(relying_party_url)
Given a relying party discovery URL return a list of return_to URLs.
source code
 
verifyReturnTo(realm_str, return_to, _vrfy=<function getAllowedReturnURLs at 0x7fbf89b210c8>)
Verify that a return_to URL is valid for the given realm.
source code
Variables [hide private]
  _protocols = ['http', 'https']
  _top_level_domains = ['ac', 'ad', 'ae', 'aero', 'af', 'ag', 'a...
  host_segment_re = re.compile(r'(?:[-a-zA-Z0-9!\$&\'\(\)\*\+,;=...
  RP_RETURN_TO_URL_TYPE = 'http://specs.openid.net/auth/2.0/retu...
  __package__ = 'openid.server'
Function Details [hide private]

_extractReturnURL(endpoint)

source code 

If the endpoint is a relying party OpenID return_to endpoint, return the endpoint URL. Otherwise, return None.

This function is intended to be used as a filter for the Yadis filtering interface.

Parameters:
  • endpoint - An XRDS BasicServiceEndpoint, as returned by performing Yadis dicovery.
Returns: str or NoneType
The endpoint URL or None if the endpoint is not a relying party endpoint.

returnToMatches(allowed_return_to_urls, return_to)

source code 

Is the return_to URL under one of the supplied allowed return_to URLs?

Since: 2.1.0

getAllowedReturnURLs(relying_party_url)

source code 

Given a relying party discovery URL return a list of return_to URLs.

Since: 2.1.0

verifyReturnTo(realm_str, return_to, _vrfy=<function getAllowedReturnURLs at 0x7fbf89b210c8>)

source code 

Verify that a return_to URL is valid for the given realm.

This function builds a discovery URL, performs Yadis discovery on it, makes sure that the URL does not redirect, parses out the return_to URLs, and finally checks to see if the current return_to URL matches the return_to.

Returns:
True if the return_to URL is valid for the realm
Raises:

Since: 2.1.0


Variables Details [hide private]

_top_level_domains

Value:
['ac',
 'ad',
 'ae',
 'aero',
 'af',
 'ag',
 'ai',
 'al',
...

host_segment_re

Value:
re.compile(r'(?:[-a-zA-Z0-9!\$&\'\(\)\*\+,;=\._~]|%[a-zA-Z0-9]{2})+$')

RP_RETURN_TO_URL_TYPE

Value:
'http://specs.openid.net/auth/2.0/return_to'