Skip to content

WWW-Authenticate header is required per RFC 9110 Section 11.6.1 - #1278

Open
Chenjp wants to merge 1 commit into
apache:mainfrom
Chenjp:sslauth401_promote_header
Open

Chenjp wants to merge 1 commit into
apache:mainfrom
Chenjp:sslauth401_promote_header

Conversation

@Chenjp

@Chenjp Chenjp commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

A server generating a 401 (Unauthorized) response MUST send a WWW-Authenticate header field containing at least one challenge.

Assign header WWW-Authenticate: ClientCertificate for SSL Cert failure.

A server generating a 401 (Unauthorized) response MUST send a WWW-Authenticate header field containing at least one challenge.
@arturobernalg

Copy link
Copy Markdown
Member

I don’t think introducing a new HTTP authentication scheme is the right approach here.

CLIENT-CERT authentication takes place at the TLS layer. What is the expected client behaviour when receiving a WWW-Authenticate: ClientCertificate challenge?

RFC 9110 requires an applicable challenge, not merely a header containing an arbitrary scheme name.

@michael-o

Copy link
Copy Markdown
Member

This sounds wrong. 401 appears in this case because client auth is optional otherwise the TLS handshake would fail right way. @reschke can you help?

@Chenjp

Chenjp commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

It is a opportunity to inform client - why 401.
Not basic auth, not digest auth, nor the target resource security constraints.

@Chenjp

Chenjp commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

It is a opportunity to inform client - why 401. Not basic auth, not digest auth, nor the target resource security constraints.

or CLIENT_CERT_AUTH instead.

public interface HttpServletRequest extends ServletRequest {

    /**
     * String identifier for Basic authentication. Value "BASIC"
     */
    String BASIC_AUTH = "BASIC";
    /**
     * String identifier for Form authentication. Value "FORM"
     */
    String FORM_AUTH = "FORM";
    /**
     * String identifier for Client Certificate authentication. Value "CLIENT_CERT"
     */
    String CLIENT_CERT_AUTH = "CLIENT_CERT";
    /**
     * String identifier for Digest authentication. Value "DIGEST"
     */
    String DIGEST_AUTH = "DIGEST";

@michael-o

Copy link
Copy Markdown
Member

It is a opportunity to inform client - why 401. Not basic auth, not digest auth, nor the target resource security constraints.

or CLIENT_CERT_AUTH instead.

public interface HttpServletRequest extends ServletRequest {

    /**
     * String identifier for Basic authentication. Value "BASIC"
     */
    String BASIC_AUTH = "BASIC";
    /**
     * String identifier for Form authentication. Value "FORM"
     */
    String FORM_AUTH = "FORM";
    /**
     * String identifier for Client Certificate authentication. Value "CLIENT_CERT"
     */
    String CLIENT_CERT_AUTH = "CLIENT_CERT";
    /**
     * String identifier for Digest authentication. Value "DIGEST"
     */
    String DIGEST_AUTH = "DIGEST";

These values are used in the web.xml.

@arturobernalg

Copy link
Copy Markdown
Member

CLIENT_CERT has the same problem, it is just another name that no client can answer: it is the Servlet API getAuthType() value, not an HTTP authentication scheme, and there is no Authorization header a client could send back. For this mechanism the challenge is the TLS CertificateRequest, which the server has either already sent or was unable to send for this request. RFC 9110 11.4 treats transport level authentication as an additional mechanism outside the challenge-response framework, and 15.5.2 requires a challenge applicable to the target resource, which no HTTP challenge is here, so I think the real issue is that 401 is the wrong status here, not that a header is missing. I would rather see this return 403 (15.5.4).

@michael-o

michael-o commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

SASL solved this very elegantly with EXTERNAL. I consider 403 as wrong. I still would like to hear Julian's opinion.

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.

3 participants