19 lines
653 B
Python
Raw Normal View History

from functools import wraps
2025-07-15 09:54:01 +01:00
from flask import request, jsonify, Blueprint, make_response
auth_blueprint = Blueprint("auth", __name__)
def check_auth(username, password):
2025-07-15 11:38:59 +01:00
return True
def requires_basic_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if not auth or not check_auth(auth.username, auth.password):
return jsonify({"message": "Could not verify"}), 401, {'WWW-Authenticate': 'Basic realm="Login Required"'}
2025-07-15 09:28:47 +01:00
return f(auth.username,auth.password, *args, **kwargs)
return decorated
2025-07-15 09:28:47 +01:00
def check_login(username, password):
2025-07-15 11:38:59 +01:00
return jsonify({"auth": "Success"})