Rename auth_key to srvkey

This commit is contained in:
Kload 2013-10-16 20:37:12 +02:00
parent f51d64388e
commit dec4ed143a
2 changed files with 3 additions and 3 deletions

View file

@ -37,7 +37,7 @@ end
function set_auth_cookie (user, domain) function set_auth_cookie (user, domain)
local maxAge = 60 * 60 * 24 * 7 -- 1 week local maxAge = 60 * 60 * 24 * 7 -- 1 week
local expire = ngx.req.start_time() + maxAge local expire = ngx.req.start_time() + maxAge
local hash = ngx.md5(auth_key.. local hash = ngx.md5(srvkey..
"|" ..ngx.var.remote_addr.. "|" ..ngx.var.remote_addr..
"|"..user.. "|"..user..
"|"..expire) "|"..expire)
@ -99,7 +99,7 @@ function check_cookie ()
-- Check expire time -- Check expire time
if (ngx.req.start_time() <= tonumber(ngx.var.cookie_SSOwAuthExpire)) then if (ngx.req.start_time() <= tonumber(ngx.var.cookie_SSOwAuthExpire)) then
-- Check hash -- Check hash
local hash = ngx.md5(auth_key.. local hash = ngx.md5(srvkey..
"|"..ngx.var.remote_addr.. "|"..ngx.var.remote_addr..
"|"..ngx.var.cookie_SSOwAuthUser.. "|"..ngx.var.cookie_SSOwAuthUser..
"|"..ngx.var.cookie_SSOwAuthExpire) "|"..ngx.var.cookie_SSOwAuthExpire)

View file

@ -5,7 +5,7 @@ math = require "math"
-- Set random key -- Set random key
math.randomseed(os.time()) math.randomseed(os.time())
auth_key = math.random(1111111, 9999999) srvkey = math.random(1111111, 9999999)
-- Shared table -- Shared table
tokens = {} tokens = {}