diff --git a/changelog/unreleased/kong/fix-realm-compat-changes-basic-auth.yml b/changelog/unreleased/kong/fix-realm-compat-changes-basic-auth.yml new file mode 100644 index 000000000000..6f2ce9d7beae --- /dev/null +++ b/changelog/unreleased/kong/fix-realm-compat-changes-basic-auth.yml @@ -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 diff --git a/changelog/unreleased/kong/fix-realm-compat-changes-key-auth.yml b/changelog/unreleased/kong/fix-realm-compat-changes-key-auth.yml new file mode 100644 index 000000000000..bb8d06a31467 --- /dev/null +++ b/changelog/unreleased/kong/fix-realm-compat-changes-key-auth.yml @@ -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 diff --git a/kong/clustering/compat/removed_fields.lua b/kong/clustering/compat/removed_fields.lua index 9893dd60ceff..213c0e0e71e2 100644 --- a/kong/clustering/compat/removed_fields.lua +++ b/kong/clustering/compat/removed_fields.lua @@ -115,6 +115,9 @@ return { opentelemetry = { "sampling_rate", }, + basic_auth = { + "realm" + } }, -- Any dataplane older than 3.7.0 @@ -135,5 +138,8 @@ return { ai_response_transformer = { "llm.model.options.upstream_path", }, + key_auth = { + "realm" + } }, } diff --git a/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua b/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua index 03867d030415..f4428b18162c 100644 --- a/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua +++ b/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua @@ -627,6 +627,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)