Skip to content

fix(key-auth): fix the issue of credentials reading failure#3559

Open
NelZyhh wants to merge 1 commit intoalibaba:mainfrom
NelZyhh:fix/key-auth-credential
Open

fix(key-auth): fix the issue of credentials reading failure#3559
NelZyhh wants to merge 1 commit intoalibaba:mainfrom
NelZyhh:fix/key-auth-credential

Conversation

@NelZyhh
Copy link

@NelZyhh NelZyhh commented Mar 4, 2026

Ⅰ. Describe what this PR did

This PR enhances the key-auth Go plugin to align with the C++ implementation and introduces more flexible configuration options for consumers.

Key Changes:

  1. Support for Multiple Credentials : Added the credentials field to the Consumer configuration. This allows a single consumer to possess multiple valid API keys (tokens).
  2. Consumer-Level Customization : Enabled keys , in_query , and in_header configurations at the consumer level. This allows specific consumers to use different API key names or extraction sources (header/query) independent of the global settings.
  3. Authentication Logic Alignment :
    • Removed the limitation that rejected requests containing multiple tokens (previously returning deniedMultiKeyAuthData ).
    • Updated the authentication flow to iterate through all extracted tokens. The request is now successfully authenticated if any valid credential is found among the tokens.
    • This change ensures the behavior is consistent with the C++ version of the key-auth plugin.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Ⅵ. AI Coding Tool Usage Checklist (if applicable)

Please check all applicable items:

  • For new standalone features (e.g., new wasm plugin or golang-filter plugin):

    • I have created a design/ directory in the plugin folder
    • I have added the design document to the design/ directory
    • I have included the AI Coding summary below
  • For regular updates/changes (not new plugins):

    • I have provided the prompts/instructions I gave to the AI Coding tool below
    • I have included the AI Coding summary below

AI Coding Prompts (for regular updates)

AI Coding Summary

@CLAassistant
Copy link

CLAassistant commented Mar 4, 2026

CLA assistant check
All committers have signed the CLA.

@NelZyhh NelZyhh force-pushed the fix/key-auth-credential branch from 5b0bc08 to 0b219d0 Compare March 4, 2026 11:26
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

Successfully merging this pull request may close these issues.

2 participants