add hty sudoer token chek

This commit is contained in:
李勇
2021-11-24 20:08:31 +08:00
parent 2a5c21d4ed
commit 727e7a401b
2 changed files with 24 additions and 3 deletions
+20 -2
View File
@@ -25,6 +25,24 @@ while true do
return
end
local authorization = ngx.req.get_headers()["Authorization"]
if authorization then
ngx.log(ngx.INFO, 'Check request authorization Authorization -> ', ngx.req.get_headers().Authorization)
else
ngx.log(ngx.ERR, 'Request header no authorization ! ')
ngx.status = 500
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
local authorization = ngx.req.get_headers()["HtySudoerToken"]
if authorization then
ngx.log(ngx.INFO, 'Check request authorization HtySudoerToken -> ', ngx.req.get_headers().HtySudoerToken)
else
ngx.log(ngx.ERR, 'Request header no hty sudoer token ! ')
ngx.status = 500
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
if typ == "header" then
--"Content-Disposition","form-data; name=\"files[]\"; filename=\"Song-of-joy.png\""
@@ -63,11 +81,11 @@ while true do
local http = require "resty.http"
local httpc = http.new()
local remote_url = string.format("%s/api/v1/ts/create_task", task_server)
ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
ngx.log(ngx.INFO, 'Authorization -> ', ngx.req.get_headers().Authorization)
ngx.log(ngx.INFO, 'HtySudoerToken -> ', ngx.req.get_headers().HtySudoerToken)
local body_text = cjson.encode({task_type = TaskTypes.UPLOAD_PICTURE, data = {images = files}})
ngx.log(ngx.INFO, 'UPLOAD_PICTURE *body_text* ->', body_text)