Skip to content

Commit

Permalink
fix(bk-auth-verify): move into the bk_secret not empty section
Browse files Browse the repository at this point in the history
  • Loading branch information
wklken committed Nov 27, 2023
1 parent 73e1c8d commit ba0bb5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/apisix/plugins/bk-auth-verify/app-account-verifier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ function _M.verify_app(self)
return bk_app_define.new_anonymous_app("app code cannot be empty")
end

-- check the length before call bkauth apis
if string.len(self.app_code) > 32 then
return bk_app_define.new_anonymous_app("app code cannot be longer than 32 characters")
end
if string.len(self.app_secret) > 128 then
return bk_app_define.new_anonymous_app("app secret cannot be longer than 128 characters")
end

if not pl_types.is_empty(self.app_secret) then
-- check the length before call bkauth apis
if string.len(self.app_code) > 32 then
return bk_app_define.new_anonymous_app("app code cannot be longer than 32 characters")
end
if string.len(self.app_secret) > 128 then
return bk_app_define.new_anonymous_app("app secret cannot be longer than 128 characters")
end

return self:verify_by_app_secret()
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe(
"app_code length is greather 32", function()
local auth_params = auth_params_mod.new({
bk_app_code = "123456789012345678901234567890123",
bk_app_secret = "world",
})
local verifier = app_account_verifier_mod.new(auth_params)

Expand Down

0 comments on commit ba0bb5e

Please sign in to comment.