Add log messages for debugging connection to auth server
This commit is contained in:
parent
4355e6dc42
commit
b01f233208
1 changed files with 7 additions and 1 deletions
|
@ -61,28 +61,34 @@ class Provider(AuthProviderSettings):
|
||||||
if self.info_url is not None:
|
if self.info_url is not None:
|
||||||
try:
|
try:
|
||||||
provider_info = await client.get(self.info_url)
|
provider_info = await client.get(self.info_url)
|
||||||
except Exception:
|
except Exception as err:
|
||||||
|
logger.debug("Provider_info: cannot connect")
|
||||||
|
logger.exception(err)
|
||||||
raise NoPublicKey
|
raise NoPublicKey
|
||||||
try:
|
try:
|
||||||
self.info = provider_info.json()
|
self.info = provider_info.json()
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
|
logger.debug("Provider_info: cannot decode json response")
|
||||||
raise NoPublicKey
|
raise NoPublicKey
|
||||||
if "public_key" in self.info:
|
if "public_key" in self.info:
|
||||||
# For Keycloak
|
# For Keycloak
|
||||||
try:
|
try:
|
||||||
public_key = str(self.info["public_key"])
|
public_key = str(self.info["public_key"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
logger.debug("Provider_info: cannot get public_key")
|
||||||
raise NoPublicKey
|
raise NoPublicKey
|
||||||
elif "keys" in self.info:
|
elif "keys" in self.info:
|
||||||
# For Forgejo/Gitea
|
# For Forgejo/Gitea
|
||||||
try:
|
try:
|
||||||
public_key = str(self.info["keys"][0]["n"])
|
public_key = str(self.info["keys"][0]["n"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
logger.debug("Provider_info: cannot get key 0.n")
|
||||||
raise NoPublicKey
|
raise NoPublicKey
|
||||||
if self.public_key_url is not None:
|
if self.public_key_url is not None:
|
||||||
resp = await client.get(self.public_key_url)
|
resp = await client.get(self.public_key_url)
|
||||||
public_key = resp.text
|
public_key = resp.text
|
||||||
if public_key is None:
|
if public_key is None:
|
||||||
|
logger.debug("Provider_info: cannot determine public key")
|
||||||
raise NoPublicKey
|
raise NoPublicKey
|
||||||
self.public_key = "\n".join(
|
self.public_key = "\n".join(
|
||||||
["-----BEGIN PUBLIC KEY-----", public_key, "-----END PUBLIC KEY-----"]
|
["-----BEGIN PUBLIC KEY-----", public_key, "-----END PUBLIC KEY-----"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue