def discover_myproxy(openid): try: uri, endpoints = getServiceEndpoints(openid) except DiscoveryFailure: return None for e in endpoints: if e.matchTypes(['urn:esg:security:myproxy-service']): myproxy_url_parsed = urlparse(e.uri) return myproxy_url_parsed.hostname return None
def set_urls(self, openid): try: uri, endpoints = getServiceEndpoints(openid) except DiscoveryFailure: return for e in endpoints: if e.matchTypes(['urn:esg:security:oauth:endpoint:authorize']): self.AUTHORIZATION_URL = e.uri elif e.matchTypes(['urn:esg:security:oauth:endpoint:access']): self.ACCESS_TOKEN_URL = e.uri elif e.matchTypes(['urn:esg:security:oauth:endpoint:resource']): self.CERTIFICATE_URL = e.uri self.DEFAULT_SCOPE = [e.uri + '/']
def getAllowedReturnURLs(relying_party_url): """Given a relying party discovery URL return a list of return_to URLs. @since: 2.1.0 """ (rp_url_after_redirects, return_to_urls) = services.getServiceEndpoints( relying_party_url, _extractReturnURL) if rp_url_after_redirects != relying_party_url: # Verification caused a redirect raise RealmVerificationRedirected( relying_party_url, rp_url_after_redirects) return return_to_urls
def discover(openid): try: uri, endpoints = getServiceEndpoints(openid) except DiscoveryFailure: return None authorize = None access = None for e in endpoints: if e.matchTypes(['urn:esg:security:oauth:endpoint:authorize']): authorize = True elif e.matchTypes(['urn:esg:security:oauth:endpoint:access']): access = True if authorize and access: return 'OAuth2' return 'OpenID'