Spaces:
Sleeping
Sleeping
barisaydin
commited on
Commit
•
4464da3
1
Parent(s):
81b3101
Upload validate_api_key.lua
Browse files- validate_api_key.lua +10 -0
validate_api_key.lua
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
local valid_api_key = "c64033672f5ca984dfe962909671961e8012f0c5"
|
2 |
+
|
3 |
+
local headers = ngx.req.get_headers()
|
4 |
+
local api_key = headers["Authorization"]
|
5 |
+
|
6 |
+
if api_key ~= "Bearer " .. valid_api_key then
|
7 |
+
ngx.status = ngx.HTTP_UNAUTHORIZED
|
8 |
+
ngx.say("Unauthorized")
|
9 |
+
return ngx.exit(ngx.HTTP_UNAUTHORIZED)
|
10 |
+
end
|