forked from Github-Mirrors/canaille
Stop caching server metadata
This commit is contained in:
parent
6d2e9b2011
commit
f086bcd7da
2 changed files with 12 additions and 22 deletions
|
@ -330,9 +330,9 @@ class ClientManagementMixin:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_server_metadata(self):
|
def get_server_metadata(self):
|
||||||
from .well_known import cached_openid_configuration
|
from .well_known import openid_configuration
|
||||||
|
|
||||||
result = cached_openid_configuration()
|
result = openid_configuration()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def resolve_public_key(self, request):
|
def resolve_public_key(self, request):
|
||||||
|
|
|
@ -13,11 +13,8 @@ from .oauth import get_issuer
|
||||||
bp = Blueprint("home", __name__, url_prefix="/.well-known")
|
bp = Blueprint("home", __name__, url_prefix="/.well-known")
|
||||||
|
|
||||||
|
|
||||||
def cached_oauth_authorization_server():
|
def oauth_authorization_server():
|
||||||
if "oauth_authorization_server" in g:
|
return {
|
||||||
return g.oauth_authorization_server
|
|
||||||
|
|
||||||
g.oauth_authorization_server = {
|
|
||||||
"issuer": get_issuer(),
|
"issuer": get_issuer(),
|
||||||
"authorization_endpoint": url_for("oidc.endpoints.authorize", _external=True),
|
"authorization_endpoint": url_for("oidc.endpoints.authorize", _external=True),
|
||||||
"token_endpoint": url_for("oidc.endpoints.issue_token", _external=True),
|
"token_endpoint": url_for("oidc.endpoints.issue_token", _external=True),
|
||||||
|
@ -56,15 +53,10 @@ def cached_oauth_authorization_server():
|
||||||
"code_challenge_methods_supported": ["plain", "S256"],
|
"code_challenge_methods_supported": ["plain", "S256"],
|
||||||
}
|
}
|
||||||
|
|
||||||
return g.oauth_authorization_server
|
|
||||||
|
|
||||||
|
def openid_configuration():
|
||||||
def cached_openid_configuration():
|
return {
|
||||||
if "openid_configuration" in g:
|
**oauth_authorization_server(),
|
||||||
return g.openid_configuration
|
|
||||||
|
|
||||||
g.openid_configuration = {
|
|
||||||
**cached_oauth_authorization_server(),
|
|
||||||
"end_session_endpoint": url_for("oidc.endpoints.end_session", _external=True),
|
"end_session_endpoint": url_for("oidc.endpoints.end_session", _external=True),
|
||||||
"claims_supported": [
|
"claims_supported": [
|
||||||
"sub",
|
"sub",
|
||||||
|
@ -89,17 +81,15 @@ def cached_openid_configuration():
|
||||||
"id_token_signing_alg_values_supported": ["RS256", "ES256", "HS256"],
|
"id_token_signing_alg_values_supported": ["RS256", "ES256", "HS256"],
|
||||||
}
|
}
|
||||||
|
|
||||||
return g.openid_configuration
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/oauth-authorization-server")
|
@bp.route("/oauth-authorization-server")
|
||||||
def oauth_authorization_server():
|
def oauth_authorization_server_endpoint():
|
||||||
return jsonify(cached_oauth_authorization_server())
|
return jsonify(oauth_authorization_server())
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/openid-configuration")
|
@bp.route("/openid-configuration")
|
||||||
def openid_configuration():
|
def openid_configuration_endpoint():
|
||||||
return jsonify(cached_openid_configuration())
|
return jsonify(openid_configuration())
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/webfinger")
|
@bp.route("/webfinger")
|
||||||
|
@ -108,7 +98,7 @@ def webfinger():
|
||||||
{
|
{
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": cached_openid_configuration()["issuer"],
|
"href": openid_configuration()["issuer"],
|
||||||
"rel": "http://openid.net/specs/connect/1.0/issuer",
|
"rel": "http://openid.net/specs/connect/1.0/issuer",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue