[java-oidc-common] 05/05: JCOMOIDC-197 - JSONErrorResponse returns true for indicatesSuccess

Codeberg noreply at shibboleth.net
Fri Nov 27 12:43:01 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch maint-3.4
in repository java-oidc-common.

View the commit online:
https://codeberg.org/Shibboleth/java-oidc-common/commit/1ece75898a828b1a364a385b6fec8c0a4cb0c6e5

commit 1ece75898a828b1a364a385b6fec8c0a4cb0c6e5
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Thu Nov 26 12:26:17 2026 +0000

    JCOMOIDC-197 - JSONErrorResponse returns true for indicatesSuccess
    
     - Improve test to include HTTP 0 status code to HTTP 400 status code
    mapping.
    
    https://shibboleth.atlassian.net/browse/JCOMOIDC-197
---
 .../oidc/profile/messaging/JSONErrorResponseTest.java   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/oidc-common-profile-api/src/test/java/net/shibboleth/oidc/profile/messaging/JSONErrorResponseTest.java b/oidc-common-profile-api/src/test/java/net/shibboleth/oidc/profile/messaging/JSONErrorResponseTest.java
index 0536f789..5d11068b 100644
--- a/oidc-common-profile-api/src/test/java/net/shibboleth/oidc/profile/messaging/JSONErrorResponseTest.java
+++ b/oidc-common-profile-api/src/test/java/net/shibboleth/oidc/profile/messaging/JSONErrorResponseTest.java
@@ -67,5 +67,22 @@ public class JSONErrorResponseTest {
         Assert.assertEquals("errorCode", parsedContent.get("error"));
         Assert.assertEquals("errorDescription", parsedContent.get("error_description"));
     }
+    
+    @Test
+    public void testSuccessWithHTTP400() throws ParseException {
+    	// Do not set HTTP status code, this should now result in an HTTP 400
+    	content = new ErrorObject("errorCode", "errorDescription");
+        response = new JSONErrorResponse(content);
+        Assert.assertFalse(response.indicatesSuccess());
+        final HTTPResponse httpResponse = response.toHTTPResponse();
+        Assert.assertEquals(HTTPResponse.SC_BAD_REQUEST, httpResponse.getStatusCode());
+        Assert.assertEquals("application/json; charset=UTF-8", httpResponse.getEntityContentType().toString());
+        Assert.assertNull(httpResponse.getCacheControl());
+        Assert.assertNull(httpResponse.getPragma());
+        final JSONObject parsedContent =
+                (JSONObject) new JSONParser(JSONParser.MODE_PERMISSIVE).parse(httpResponse.getContent());
+        Assert.assertEquals("errorCode", parsedContent.get("error"));
+        Assert.assertEquals("errorDescription", parsedContent.get("error_description"));
+    }
 
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list