@@ 60,15 60,24 @@ class OAuth2Issuer(BaseConfigDict):
"RFC 8414: OAuth 2.0 Authorization Server Metadata"
if not self["meta"]:
- for wellknown in ["oauth-authorization-server", "openid-configuration"]:
+ try:
+ oauth_meta = http_get(
+ self.issuer + "/.well-known/oauth-authorization-server"
+ )
+ oauth_meta.raise_for_status()
+ self["meta"] = oauth_meta.json()
+ return self["meta"]
+ except:
try:
- self["meta"] = http_get(
- self.issuer + "/.well-known/" + wellknown
- ).json()
- break
+ oidc_meta = http_get(
+ self.issuer + "/.well-known/openid-configuration"
+ )
+ self["meta"] = oidc_meta.json()
+ return self["meta"]
except:
pass
- self.save()
+ raise # error about first endpoint
+
return self["meta"]
def register(self, data: dict):