apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
995 stars 341 forks source link

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

Closed nilimaomni closed 3 weeks ago

nilimaomni commented 4 months ago

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.

github-actions[bot] commented 1 month ago

This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

github-actions[bot] commented 3 weeks ago

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.