1
0
mirror of https://github.com/checktheroads/hyperglass-frr.git synced 2024-05-11 05:55:16 +00:00

swapping API key hash validating so that plain text key is stored on the secure device

This commit is contained in:
checktheroads
2019-05-23 19:28:18 -07:00
parent 3e92bd1553
commit 43864c7c4a

View File

@ -13,15 +13,14 @@ app = Flask(__name__)
api_listen_addr = getattr(configuration, "api_listen_addr", "*")
api_port = getattr(configuration, "api_port", 8080)
api_key_hash = getattr(configuration, "api_key_hash")
api_key = getattr(configuration, "api_key")
@app.route("/frr", methods=["POST"])
def frr():
headers = request.headers
auth = headers.get("X-Api-Key")
auth_type = type(auth)
if pbkdf2_sha256.verify(auth, api_key_hash) is True:
api_key_hash = headers.get("X-Api-Key")
if pbkdf2_sha256.verify(api_key, api_key_hash) is True:
try:
logger.debug(f"Validation of API key passed. Hash: {api_key_hash}")
query_json = request.get_json()