forked from Github-Mirrors/canaille
Temporary jwks endpoint
This commit is contained in:
parent
221732cb2a
commit
50a80561c8
2 changed files with 12 additions and 2 deletions
12
web/oauth.py
12
web/oauth.py
|
@ -1,6 +1,7 @@
|
||||||
|
from authlib.common.encoding import urlsafe_b64encode
|
||||||
from authlib.oauth2 import OAuth2Error
|
from authlib.oauth2 import OAuth2Error
|
||||||
from flask import Blueprint, request, session, redirect
|
from flask import Blueprint, request, session, redirect
|
||||||
from flask import render_template, jsonify, flash
|
from flask import render_template, jsonify, flash, current_app
|
||||||
from flask_babel import gettext
|
from flask_babel import gettext
|
||||||
from .models import User, Client
|
from .models import User, Client
|
||||||
from .oauth2utils import authorization, IntrospectionEndpoint, RevocationEndpoint
|
from .oauth2utils import authorization, IntrospectionEndpoint, RevocationEndpoint
|
||||||
|
@ -66,3 +67,12 @@ def introspect_token():
|
||||||
@bp.route("/revoke", methods=["POST"])
|
@bp.route("/revoke", methods=["POST"])
|
||||||
def revoke_token():
|
def revoke_token():
|
||||||
return authorization.create_endpoint_response(RevocationEndpoint.ENDPOINT_NAME)
|
return authorization.create_endpoint_response(RevocationEndpoint.ENDPOINT_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/jwks.json")
|
||||||
|
def jwks():
|
||||||
|
#TODO: Do not share secrets here!
|
||||||
|
key = urlsafe_b64encode(current_app.config["JWT"]["KEY"].encode("utf-8")).decode(
|
||||||
|
"utf-8"
|
||||||
|
)
|
||||||
|
return jsonify({"keys": [{"kid": None, "kty": "oct", "k": key}]})
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% if logo_url %}
|
{% if logo_url %}
|
||||||
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
|
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<i class="massive sign in icon"></i>
|
<i class="massive sign in icon image ui"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2 class="ui center aligned header">
|
<h2 class="ui center aligned header">
|
||||||
|
|
Loading…
Reference in a new issue