MCPcopy Index your code
hub / github.com/OWASP/Python-Honeypot / is_authorized

Function is_authorized

api/server.py:108–122  ·  view source on GitHub ↗

check the validity of API key Returns: 200 HTTP code if it's valid otherwise 401 error

()

Source from the content-addressed store, hash-verified

106
107
108def is_authorized():
109 """
110 check the validity of API key
111
112 Returns:
113 200 HTTP code if it's valid otherwise 401 error
114
115 """
116 api_access_key = app.config["OWASP_HONEYPOT_CONFIG"]["api_access_key"]
117
118 key_from_request = get_value_from_request("key")
119
120 if api_access_key is not None and api_access_key != key_from_request:
121 abort(401, "invalid API key")
122 return True
123
124
125@app.errorhandler(400)

Callers 1

authorization_checkFunction · 0.85

Calls 1

get_value_from_requestFunction · 0.85

Tested by

no test coverage detected