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

feat: Add support for multiple plugins with a single ApisixConsumer #2215

Open
nilimaomni opened this issue Apr 17, 2024 · 0 comments
Open

Comments

@nilimaomni
Copy link

Description

I want to use multiple auth mechanism in a single route which requires to create consumer with multiple auth plugin. This is possible via apisix admin api. Example:

curl http://localhost:9180/apisix/admin/consumers -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "username": "xyz",
    "plugins": {
        "hmac-auth": {
            "access_key": "ejncd934fie",
            "secret_key": "whrbkjndc239o",
            "validate_request_body": true
        },
        "key-auth": {
            "key": "auth-one"
        }
    }
}'

But for convenience I want to keep it in config file and want to create consumer via ApisixConsumer CRD. I want something like this:

kind: ApisixConsumer
metadata:
  name: jack
spec:
  authParameter:
      hmacAuth:
        value:
          access_key: "ejncd934fie"
          secret_key: "whrbkjndc239o"
          validate_request_body: true
      keyAuth:
        value:
          key: "auth-one"

It works for single plugin consumer But more than one schema (plugin config) is not supported, hence throwing error :

The ApisixConsumer "jack" is invalid: : Invalid value: "": "spec.authParameter" must validate one and only one schema (oneOf). Found 2 valid alternatives

Kindly add support for the above mentioned feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant