This commit is contained in:
2021-11-28 14:46:40 +08:00
parent 6e4207617a
commit d487c59c01
2 changed files with 10 additions and 18 deletions
-6
View File
@@ -34,11 +34,7 @@
# resty.index # resty.index
# site # site
server { server {
# set $servername "music-room.alchemy-studio.cn";
set $servername "test.localhost"; # set in your /etc/hosts
# server_name $servername;
server_name "test.localhost"; server_name "test.localhost";
# listen 443 ssl;
listen 8088; listen 8088;
# disable in local test env # disable in local test env
@@ -52,8 +48,6 @@ server {
set $task_server "https://127.0.0.1:8080"; # task server host set $task_server "https://127.0.0.1:8080"; # task server host
set $htyuc "http://127.0.0.1:8088"; #htyuc host set $htyuc "http://127.0.0.1:8088"; #htyuc host
#set $resty_loc "/usr/local/openresty";
set $resty_loc "/usr/local/opt/openresty"; # MacOS set $resty_loc "/usr/local/opt/openresty"; # MacOS
set $convert "/usr/local/bin/convert"; set $convert "/usr/local/bin/convert";
+8 -10
View File
@@ -77,16 +77,16 @@ local function verifyJwtToken(encrypted_token)
if not res then if not res then
ngx.status = ngx.HTTP_UNAUTHORIZED ngx.status = ngx.HTTP_UNAUTHORIZED
ngx.header.content_type = "application/json; charset=utf-8" ngx.header.content_type = "application/json; charset=utf-8"
ngx.log(ngx.ERR, "Jwt token verify request error ! ") ngx.log(ngx.ERR, "CAN'T VERIFY JWT TOKEN!")
ngx.exit(ngx.HTTP_UNAUTHORIZED) ngx.exit(ngx.HTTP_UNAUTHORIZED)
else else
if 200 ~= res.status then if 200 ~= res.status then
ngx.log(ngx.ERR, "Jwt token verify error ! ", err) ngx.log(ngx.ERR, "JWT TOKEN VERIFICATION ERROR!", err)
ngx.exit(res.status) ngx.exit(res.status)
end end
end end
ngx.log(ngx.INFO, "Jwt token verify ok .") ngx.log(ngx.INFO, "JWT TOKEN VERIFICATION PASSED.")
end end
@@ -102,15 +102,14 @@ local function decodeJwtToken(encrypted_token)
end end
ngx.log(ngx.INFO, "JWT: " .. cjson.encode(jwt_obj)) ngx.log(ngx.INFO, "JWT: " .. cjson.encode(jwt_obj))
ngx.log(ngx.INFO, "jwt object : payload : sub " .. jwt_obj.payload.sub)
local htytoken = cjson.decode(jwt_obj.payload.sub) local htytoken = cjson.decode(jwt_obj.payload.sub)
ngx.log(ngx.INFO, "htytoken : token_id " .. htytoken.token_id) ngx.log(ngx.INFO, "HTY_TOKEN : token_id " .. htytoken.token_id)
ngx.log(ngx.INFO, "htytoken : hty_id " .. htytoken.hty_id) ngx.log(ngx.INFO, "HTY_TOKEN : hty_id " .. htytoken.hty_id)
ngx.log(ngx.INFO, "htytoken : app_id " .. htytoken.app_id) ngx.log(ngx.INFO, "HTY_TOKEN : app_id " .. htytoken.app_id)
ngx.log(ngx.INFO, "htytoken : ts " .. htytoken.ts) ngx.log(ngx.INFO, "HTY_TOKEN : ts " .. htytoken.ts)
ngx.log(ngx.INFO, "htytoken : roles " .. htytoken.roles) ngx.log(ngx.INFO, "HTY_TOKEN : roles " .. htytoken.roles)
return htytoken return htytoken
end end
@@ -150,7 +149,6 @@ while true do
--end --end
if type == "header" then if type == "header" then
--"Content-Disposition","form-data; name=\"files[]\"; filename=\"Song-of-joy.png\"" --"Content-Disposition","form-data; name=\"files[]\"; filename=\"Song-of-joy.png\""
--"Content-Type","image\/png" --"Content-Type","image\/png"
local key = res[1] local key = res[1]