Skip to content

Commit

Permalink
Testing reverting
Browse files Browse the repository at this point in the history
  • Loading branch information
Filienko committed Aug 14, 2024
1 parent 005ad1d commit 736487e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions jwt_proxy/api.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
from flask import Blueprint, abort, current_app, jsonify, request
from flask import Blueprint, abort, current_app, jsonify, request, json as flask_json
import jwt
import requests
import json
from flask.json.provider import DefaultJSONProvider

from jwt_proxy.audit import audit_HAPI_change

blueprint = Blueprint('auth', __name__)
SUPPORTED_METHODS = ('GET', 'POST', 'PUT', 'DELETE', 'OPTIONS')

# Workaround no JSON representation for datetime.timedelta
class CustomJSONProvider(DefaultJSONProvider):
@staticmethod
def default(obj):
return "Not_None"


def proxy_request(req, upstream_url, user_info=None):
"""Forward request to given url"""
Expand Down Expand Up @@ -101,6 +94,14 @@ def smart_configuration():
@blueprint.route("/settings/<string:config_key>")
def config_settings(config_key):
"""Non-secret application settings"""

# workaround no JSON representation for datetime.timedelta
class CustomJSONEncoder(flask_json.JSONEncoder):
def default(self, obj):
return str(obj)

current_app.json_encoder = CustomJSONEncoder

# return selective keys - not all can be be viewed by users, e.g.secret key
blacklist = ("SECRET", "KEY")

Expand Down

0 comments on commit 736487e

Please sign in to comment.