Skip to content

Commit 433e8e5

Browse files
committed
polishing
1 parent b670790 commit 433e8e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

facade-poc/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# Hardcoded API key
77
API_KEY = "TEST-API-KEY"
88
HEADER_NAME = "X-API-Key"
9-
# First endpoint
9+
10+
# Unsecured endpoint
1011
@app.route('/unsecured', methods=['GET'])
1112
def unsecured():
1213
data = {'message': 'This is an unsecured endpoint.'}
@@ -18,10 +19,11 @@ def endpoint2():
1819
# Check if API key is provided in the request headers
1920
provided_api_key = request.headers.get(HEADER_NAME)
2021

22+
# API key is invalid, return send unauthorized
2123
if provided_api_key != API_KEY:
2224
return jsonify({'error': 'Unauthorized access. Invalid API key.'}), 401
2325

24-
# API key is valid, return data
26+
2527
data = {'message': 'This is a secured endpoint.'}
2628
return jsonify(data)
2729

0 commit comments

Comments
 (0)