Ejemplo n.º 1
0
 def openid_url(self, **kwargs):
     """ Does XRD discovery and returns OpenID URL. """
     kwargs["hd"] = self.domain_name
     url = self.XRDS_URL + "?" + urlencode(kwargs)
     response = urlopen(url)
     data = response.read()
     if response.code == 200:
         xrd = etxrd.parseXRDS(data)
         for service in etxrd.iterServices(xrd):
             if self.OPENID_ENDPOINT_TYPE in etxrd.getTypeURIs(service):
                 return etxrd.sortedURIs(service)[0]
     return LOGIN_ERROR_URL
Ejemplo n.º 2
0
 def openid_url(self, **kwargs):
     """ Does XRD discovery and returns OpenID URL. """
     kwargs['hd'] = self.domain_name
     url = self.XRDS_URL + '?' + urlencode(kwargs)
     response = urlopen(url)
     data = response.read()
     if response.code == 200:
         xrd = etxrd.parseXRDS(data)
         for service in etxrd.iterServices(xrd):
             if self.OPENID_ENDPOINT_TYPE in etxrd.getTypeURIs(service):
                 return etxrd.sortedURIs(service)[0]
     return LOGIN_ERROR_URL
Ejemplo n.º 3
0
def applyFilter(normalized_uri, xrd_data, flt=None):
    """Generate an iterable of endpoint objects given this input data,
    presumably from the result of performing the Yadis protocol.

    @param normalized_uri: The input URL, after following redirects,
        as in the Yadis protocol.

    @param xrd_data: The XML text the XRDS file fetched from the
        normalized URI.
    @type xrd_data: six.binary_type
    """
    flt = mkFilter(flt)
    et = parseXRDS(xrd_data)

    endpoints = []
    for service_element in iterServices(et):
        endpoints.extend(
            flt.getServiceEndpoints(normalized_uri, service_element))

    return endpoints
Ejemplo n.º 4
0
def applyFilter(normalized_uri, xrd_data, flt=None):
    """Generate an iterable of endpoint objects given this input data,
    presumably from the result of performing the Yadis protocol.

    @param normalized_uri: The input URL, after following redirects,
        as in the Yadis protocol.

    @param xrd_data: The XML text the XRDS file fetched from the
        normalized URI.
    @type xrd_data: six.binary_type
    """
    flt = mkFilter(flt)
    et = parseXRDS(xrd_data)

    endpoints = []
    for service_element in iterServices(et):
        endpoints.extend(
            flt.getServiceEndpoints(normalized_uri, service_element))

    return endpoints