Skip to content

Conversation

@josephdecock
Copy link
Member

When the mtls middleware fails to validate the incoming client
certificate, or if no certificate is presented, it now returns an HTTP
400 response, and includes the standardized json error:

{
   "error": "invalid_client",
   "error_description": "mTLS authentication failed"
 }

This conforms to RFC 8705:

If no certificate is presented, or that which is presented doesn't
match that which is expected for the given client_id, the
authorization server returns a normal OAuth 2.0 error response per
Section 5.2 of [RFC6749] with the invalid_client error code to
indicate failed client authentication.

When the mtls middleware fails to validate the incoming client
certificate, or if no certificate is presented, it now returns an HTTP
400 response, and includes the standardized json error:
```
{
   "error": "invalid_client",
   "error_description": "mTLS authentication failed"
 }
 ```

 This conforms to RFC 8705:
> If no certificate is presented, or that which is presented doesn't
> match that which is expected for the given client_id, the
> authorization server returns a normal OAuth 2.0 error response per
> Section 5.2 of [RFC6749] with the invalid_client error code to
> indicate failed client authentication.

This commit also adds unit test coverage to the mTLS middleware.
@josephdecock josephdecock requested a review from bhazen as a code owner June 27, 2025 13:27
@josephdecock josephdecock added this to the is-7.3.0 milestone Jun 27, 2025
@josephdecock josephdecock added the area/products/identity-server Related to Identity Server label Jun 27, 2025
@josephdecock josephdecock self-assigned this Jun 27, 2025
@josephdecock josephdecock merged commit 93cdf64 into main Jun 27, 2025
17 of 18 checks passed
@josephdecock josephdecock deleted the jmdc/mtls-error-messages branch June 27, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/products/identity-server Related to Identity Server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants