Package openid :: Package consumer :: Module discover
[hide private]
[frames] | no frames]

Module discover

source code

Functions to discover OpenID endpoints from identifiers.

Classes [hide private]
  DiscoveryFailure
Raised when a YADIS protocol error occurs in the discovery process
  OpenIDServiceEndpoint
Object representing an OpenID service endpoint.
Functions [hide private]
str or unicode or NoneType
findOPLocalIdentifier(service_element, type_uris)
Find the OP-Local Identifier for this xrd:Service element.
source code
 
normalizeURL(url)
Normalize a URL, converting normalization failures to DiscoveryFailure
source code
 
normalizeXRI(xri)
Normalize an XRI, stripping its scheme if present
source code
 
arrangeByType(service_list, preferred_types)
Rearrange service_list in a new list so services are ordered by types listed in preferred_types.
source code
 
getOPOrUserServices(openid_services)
Extract OP Identifier services.
source code
(str, list(OpenIDServiceEndpoint))
discoverYadis(uri)
Discover OpenID services for a URI.
source code
 
discoverXRI(iname) source code
 
discoverNoYadis(uri) source code
 
discoverURI(uri) source code
 
discover(identifier) source code
Variables [hide private]
  OPENID_1_0_NS = 'http://openid.net/xmlns/1.0'
  OPENID_IDP_2_0_TYPE = 'http://specs.openid.net/auth/2.0/server'
  OPENID_2_0_TYPE = 'http://specs.openid.net/auth/2.0/signon'
  OPENID_1_1_TYPE = 'http://openid.net/signon/1.1'
  OPENID_1_0_TYPE = 'http://openid.net/signon/1.0'
  __package__ = 'openid.consumer'
Function Details [hide private]

findOPLocalIdentifier(service_element, type_uris)

source code 

Find the OP-Local Identifier for this xrd:Service element.

This considers openid:Delegate to be a synonym for xrd:LocalID if both OpenID 1.X and OpenID 2.0 types are present. If only OpenID 1.X is present, it returns the value of openid:Delegate. If only OpenID 2.0 is present, it returns the value of xrd:LocalID. If there is more than one LocalID tag and the values are different, it raises a DiscoveryFailure. This is also triggered when the xrd:LocalID and openid:Delegate tags are different.

Parameters:
  • service_element (ElementTree.Node) - The xrd:Service element
  • type_uris ([str]) - The xrd:Type values present in this service element. This function could extract them, but higher level code needs to do that anyway.
Returns: str or unicode or NoneType
The OP-Local Identifier for this service element, if one is present, or None otherwise.
Raises:

arrangeByType(service_list, preferred_types)

source code 

Rearrange service_list in a new list so services are ordered by types listed in preferred_types. Return the new list.

getOPOrUserServices(openid_services)

source code 

Extract OP Identifier services. If none found, return the rest, sorted with most preferred first according to OpenIDServiceEndpoint.openid_type_uris.

openid_services is a list of OpenIDServiceEndpoint objects.

Returns a list of OpenIDServiceEndpoint objects.

discoverYadis(uri)

source code 

Discover OpenID services for a URI. Tries Yadis and falls back on old-style <link rel='...'> discovery if Yadis fails.

Parameters:
  • uri (str) - normalized identity URL
Returns: (str, list(OpenIDServiceEndpoint))
(claimed_id, services)
Raises: