diff options
author | 2016-09-08 23:20:06 +0800 | |
---|---|---|
committer | 2016-09-09 14:18:38 +0800 | |
commit | b69d850757a7a8c4ff9a368df004a3cfaaf9f1e4 (patch) | |
tree | 6ba5fb3330c763fd3d550ec3671f723587beae65 /msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua | |
parent | 3be6b09b74dd3e54e631181dc37bd1e5685a1c62 (diff) |
Issue-id: OCS-9
Change-Id: I73c18bdda656c43687810930338f9a949ed08848
Signed-off-by: Zhaoxing <meng.zhaoxing1@zte.com.cn>
Diffstat (limited to 'msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua')
-rw-r--r-- | msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua deleted file mode 100644 index dd7b2ed..0000000 --- a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/iui_auth.lua +++ /dev/null @@ -1,41 +0,0 @@ -local cache = ngx.shared.ceryx -local client_ip = ngx.var.remote_addr -local uri = ngx.var.uri -if uri == "/iui/framework/login.html" then - local value, flags = cache:get(client_ip) - if not value then - return - else - ngx.redirect("/iui/framework/main-page.html") - end -end - -local referer = ngx.var.http_referer -local refererList = { - "/iui/framework/login.html", - "/iui/framework/css/login.css", - "/iui/component/thirdparty/font%-awesome/css/font%-awesome.min.css", - "/iui/framework/css/style%-custom.css" -} -local function referer_matches(t, r) - for k,_ in pairs(t) do - if string.match(r, t[k]) then - return true - end - end - return false -end - -if referer and referer_matches(refererList, referer) then - return -end - -local succ, err, forcible = cache:replace(client_ip, "place_holder", 3600) -if not succ then - if err == 'not found' then - ngx.log(ngx.WARN, "access record not found for "..client_ip..",redirect to login page") - ngx.redirect("/iui/framework/login.html") - else - ngx.log(ngx.WARN, err) - end -end
\ No newline at end of file |