File tree Expand file tree Collapse file tree
src/main/java/com/authlete/jaxrs/server/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,20 @@ public Response post(
8282 // If failed to authenticate the resource server.
8383 if (authenticateResourceServer (rsEntity , credentials ) == false )
8484 {
85+ // RFC 9701 mandates a "400 Bad Request" for unauthenticated introspection
86+ // requests as follows:
87+ //
88+ // Note: An AS compliant with this specification MUST refuse to serve
89+ // introspection requests that don't authenticate the caller and return
90+ // an HTTP status code 400. This is done to ensure token data is released
91+ // to legitimate recipients only and prevent downgrading to [RFC7662]
92+ // behavior (see Section 8.2).
93+ //
94+ // However, we return "401 Unauthorized" instead here.
95+ // While RFC 7662 leaves authentication details out of scope, we consider
96+ // 401 the semantically correct HTTP status for API caller authentication
97+ // failures and the standard behavior for protected endpoints.
98+
8599 // Return "401 Unauthorized".
86100 return Response .status (Status .UNAUTHORIZED ).build ();
87101 }
You can’t perform that action at this time.
0 commit comments