Repository navigation
Conversation
A server generating a 401 (Unauthorized) response MUST send a WWW-Authenticate header field containing at least one challenge.
|
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. |
|
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? |
|
It is a opportunity to inform client - why 401. |
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 |
|
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). |
|
SASL solved this very elegantly with |
A server generating a 401 (Unauthorized) response MUST send a WWW-Authenticate header field containing at least one challenge.
Assign header
WWW-Authenticate: ClientCertificatefor SSL Cert failure.