Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugins): add realm to removed fields #13042

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**Basic-Auth**: Fix an issue of realm field not recognized for older kong versions (before 3.6)"
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**Key-Auth**: Fix an issue of realm field not recognized for older kong versions (before 3.7)"
type: bugfix
scope: Plugin
6 changes: 6 additions & 0 deletions kong/clustering/compat/removed_fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ return {
opentelemetry = {
"sampling_rate",
},
basic_auth = {
"realm"
}
},

-- Any dataplane older than 3.7.0
Expand All @@ -135,5 +138,8 @@ return {
ai_response_transformer = {
"llm.model.options.upstream_path",
},
key_auth = {
"realm"
}
},
}
33 changes: 33 additions & 0 deletions spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,39 @@ describe("CP/DP config compat transformations #" .. strategy, function()
admin.plugins:remove({ id = ai_response_transformer.id })
end)
end)

describe("www-authenticate header in plugins (realm config)", function()
it("[basic-auth] removes realm for versions below 3.6", function()
local basic_auth = admin.plugins:insert {
name = "basic-auth",
}

local expected_basic_auth_prior_36 = cycle_aware_deep_copy(basic_auth)
expected_basic_auth_prior_36.config.realm = nil

do_assert(utils.uuid(), "3.5.0", expected_basic_auth_prior_36)

-- cleanup
admin.plugins:remove({ id = basic_auth.id })
end)

it("[key-auth] removes realm for versions below 3.7", function()
local key_auth = admin.plugins:insert {
name = "key-auth",
config = {
realm = "test"
}
}

local expected_key_auth_prior_37 = cycle_aware_deep_copy(key_auth)
expected_key_auth_prior_37.config.realm = nil

do_assert(utils.uuid(), "3.6.0", expected_key_auth_prior_37)

-- cleanup
admin.plugins:remove({ id = key_auth.id })
end)
end)
end)
end)

Expand Down
Loading