Comments (2)
Thanks @nateslo, I checked with your first solution. Now it's working fine
from kong.
Hi @pravin-raha. I believe the issue is config.{field_name}
in your entity_checks
which are nested inside of the config
table. If the entity_checks
are moved to the top level (sibling of fields), then validation succeeds.
return {
name = "oidc-acl",
fields = {
{ consumer = typedefs.no_consumer },
{ protocols = typedefs.protocols_http },
{
config = {
type = "record",
fields = {
{ whitelist = { type = "array", elements = { type = "string" }, required = false } },
{ blacklist = { type = "array", elements = { type = "string" }, required = false } },
{ userinfo_header_name = { type = "string", required = false, default = "x-userinfo" } }
},
},
},
},
-- entity checks moved to top level
entity_checks = {
{ only_one_of = { "config.whitelist", "config.blacklist" }, },
{ at_least_one_of = { "config.whitelist", "config.blacklist" }, },
},
}
Compare this to the ACL plugin, which has a very similar schema: https://github.com/Kong/kong/blob/master/kong/plugins/acl/schema.lua
Alternately, I believe that you can remove config.
from the field names and keep entity_checks
inside the config
table
return {
name = "oidc-acl",
fields = {
{ consumer = typedefs.no_consumer },
{ protocols = typedefs.protocols_http },
{
config = {
type = "record",
fields = {
{ whitelist = { type = "array", elements = { type = "string" }, required = false } },
{ blacklist = { type = "array", elements = { type = "string" }, required = false } },
{ userinfo_header_name = { type = "string", required = false, default = "x-userinfo" } }
},
entity_checks = {
{ only_one_of = { "whitelist", "blacklist" }, }, -- "config." removed
{ at_least_one_of = { "whitelist", "blacklist" }, }, -- "config." removed
},
},
},
},
}
Both pass a validation unit test but I'll let someone with more context explain the differences between the two approaches
from kong.
Related Issues (20)
- Control Plane fails to pull information from database pending "migrations finish" command HOT 2
- In Kong 3.6, X-Kong-Request-Debug-Output is not provided in the response header for successful scenarios HOT 3
- AI-Proxy plugin: "An unexpected error occurred" when upstream URL is missing port/path HOT 6
- AI Prompt Guard plugin: Unexpected error due to malformed `messages` array in request body HOT 4
- Problems with Kong installation via Helm Chart 2.38.0 HOT 3
- Admissionwebhook misses faulty regex HOT 1
- Exceptions while trying to store secrets using environment variables option HOT 8
- kong lua-resty-lock lock timeout 500 error {"message":"An unexpected error occurred"} HOT 3
- custom proxy_access_log still not working in 3.4.* HOT 3
- Kong prometheus plugin does not record 404 response codes from proxy HOT 2
- Timeout when running migrations from 3.5 to 3.6 leading to corrupted data (migration ran twice) HOT 3
- Admin API address in "New Connnection" form only support IP, not DNS. HOT 3
- Upsert target is not an upsert HOT 4
- failed to set X-Kong-Upstream-Status header while sending to client HOT 2
- [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: connection refused HOT 2
- DNS resolution failed: dns server error: 3 name error HOT 14
- Optional capture groups are broken with the request-transformer plugin and traditional_compatible router HOT 4
- Error in logs: failed to run timer HOT 2
- Database migration failed while using helm chart HOT 2
- JWT Plugin bypasses validation process occasionally on frequent requests HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kong.