def find_issuer_config_in_at(access_token): '''If there is an issuer in the AT, we fetch the ISS config and return it''' iss_config = None at_iss = tokentools.get_issuer_from_accesstoken_info(access_token) if verbose > 1: logger.info(F"Issuer: {at_iss}") if at_iss is not None: if tokentools.is_url(at_iss): config_url = at_iss + '/.well-known/openid-configuration' iss_config = get_iss_config_from_endpoint(config_url) return iss_config
def find_issuer_config_in_string(string): '''If the string provided is a URL: try several well known endpoints until the ISS config is found''' iss_config = None if string is not None: if tokentools.is_url(string): iss_config = get_iss_config_from_endpoint(string) if iss_config: return iss_config iss_config = get_iss_config_from_endpoint(string + '/oauth2') if iss_config: return iss_config iss_config = get_iss_config_from_endpoint( string + '/.well-known/openid-configuration') if iss_config: return iss_config iss_config = get_iss_config_from_endpoint( string + '/oauth2' + '/.well-known/openid-configuration') return iss_config
def test_invalid_url(self): self.assertFalse(tokentools.is_url('htp://heise.de'))
def test_valid_url_https_path(self): self.assertTrue( tokentools.is_url('https://heise.de/thi_s&is=difficult'))
def test_valid_url_ftp(self): self.assertTrue(tokentools.is_url('ftp://heise.de'))
def test_valid_url_https(self): self.assertTrue(tokentools.is_url('https://heise.de'))
def test_url_1(self): self.assertTrue(tokentools.is_url('http://heise.de'))