Skip to content

优化 key-auth 插件配置 defaultConfig consumer 时的 warn 日志 || Optimize the warning log when the key-auth plugin is configured with defaultConfig consumer #2274

@lexburner

Description

@lexburner
  • [ ✅] I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

通过 defaultConfig 管理认证,配置全局 consumer 列表,通过 matchRules 的 allow 来管理授权是一个很常见的场景,但该配置方案会导致查找全局 consumer 信息时一直有 warn 日志输出

apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
  name: key-auth-1.0.0
  namespace: higress-system
spec:
  defaultConfig:
    consumers:
    - credential: sk-123456
      name: app1
    global_auth: false
    in_header: true
    keys:
    - Authorization
    - x-api-key
  defaultConfigDisable: false
  failStrategy: FAIL_OPEN
  imagePullPolicy: UNSPECIFIED_POLICY
  matchRules:
  - config:
      allow:
      - app1
    configDisable: false
    ingress:
    - httpbin
  phase: AUTHN
  priority: 310
  url: http://xxx/plugins/key-auth/1.0.0/plugin.wasm

Ⅱ. Describe what happened

Image

Ⅲ. Describe what you expected to happen

不打印 warn 日志,改配置是正常行为

Ⅳ. How to reproduce it (as minimally and precisely as possible)

参考上述 YAML 配置 key-auth 插件


  • [ ✅] I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

It is a common scenario to manage authentication through defaultConfig, configure the global consumer list, and manage authorization through matchRules' allow, but this configuration scheme will cause warning log output to be always available when searching for global consumer information.

apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
  name: key-auth-1.0.0
  namespace: higress-system
spec:
  defaultConfig:
    Consumers:
    - credential: sk-123456
      name: app1
    global_auth: false
    in_header: true
    keys:
    - Authorization
    - x-api-key
  defaultConfigDisable: false
  failStrategy: FAIL_OPEN
  imagePullPolicy: UNSPECIFIED_POLICY
  matchRules:
  - config:
      allow:
      - app1
    configDisable: false
    ingress:
    - httpbin
  phase: AUTHN
  priority: 310
  url: http://xxx/plugins/key-auth/1.0.0/plugin.wasm

Ⅱ. Describe what happened

Image

Ⅲ. Describe what you expected to happen

Not printing the warning log, changing the configuration is normal

IV. How to reproduce it (as minimally and precisely as possible)

Refer to the above YAML configuration key-auth plugin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions