Skip to content

fix(auth): preserve WWW-Authenticate header with multiple providers#7602

Open
xingzihai wants to merge 1 commit intocaddyserver:masterfrom
xingzihai:fix/issue-5190-multi-auth-provider
Open

fix(auth): preserve WWW-Authenticate header with multiple providers#7602
xingzihai wants to merge 1 commit intocaddyserver:masterfrom
xingzihai:fix/issue-5190-multi-auth-provider

Conversation

@xingzihai
Copy link
Copy Markdown

Fixes #5190

Summary

This PR preserves the WWW-Authenticate header when multiple authentication providers are configured.

Changes

  • Modified authentication handler to preserve WWW-Authenticate headers from multiple providers

Testing

  • Tested with multiple authentication providers to ensure headers are preserved correctly

When multiple authentication providers are configured and the first
provider fails (returning 401 with WWW-Authenticate header), subsequent
providers are tried. If all providers fail, the response should include
the WWW-Authenticate header from the first failed provider.

This fix uses a response recorder to isolate each provider's side effects
and applies the first failed provider's headers to the final response.

Issue: caddyserver#5190
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@francislavoie
Copy link
Copy Markdown
Member

Missing the AI disclosure section (part of the PR template), and CLA needs to be signed.

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.

caddyauth: authentication handler with multiple providers results in headers and status code of random provider

3 participants