[java-oidc-common] branch main updated: JCOMOIDC-197 - JSONErrorResponse returns true for indicatesSuccess

Codeberg noreply at shibboleth.net
Thu Nov 26 12:26:57 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-oidc-common/commit/37fe1c62129c64387ffff61215c59e87644816ab

The following commit(s) were added to refs/heads/main by this push:
     new 37fe1c62 JCOMOIDC-197 - JSONErrorResponse returns true for indicatesSuccess
37fe1c62 is described below

commit 37fe1c62129c64387ffff61215c59e87644816ab
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