Skip to content

Commit

Permalink
feat: 调用bk-ap-gw迁移到新方案 TencentBlueKing#1608
Browse files Browse the repository at this point in the history
  • Loading branch information
owenlxu authored Jan 19, 2024
1 parent 1922eda commit ade04d8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gateway/lua/util/oauth_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,20 @@ function _M:verify_bk_token(auth_url, token)
local user_cache_value = user_cache:get(token)
if user_cache_value == nil then
local http_cli = http.new()
local auth = config.oauth
local query = "bk_app_code=" .. auth.app_code .. "&bk_app_secret=" .. auth.app_secret .. "&bk_token=" .. token
local oauth = config.oauth
local query = "bk_token=" .. token
local addr = "http://" .. auth_url .. "/api/c/compapi/v2/bk_login/get_user/?" .. query
local auth_content = '{"bk_app_code":"' .. oauth.app_code .. '","bk_app_secret":"' .. oauth.app_secret .. '"}'
--- 开始连接
http_cli:set_timeout(3000)
http_cli:connect(addr)
--- 发送请求
local res, err = http_cli:request_uri(addr, {
method = "GET",
ssl_verify = false,
headers = {
["X-Bkapi-Authorization"] = auth_content
}
})
--- 判断是否出错了
if not res then
Expand Down

0 comments on commit ade04d8

Please sign in to comment.