diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationMetadataPositiveTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationMetadataPositiveTest.java index 407f1909966..837091dcad6 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationMetadataPositiveTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationMetadataPositiveTest.java @@ -42,7 +42,6 @@ import java.io.IOException; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -142,32 +141,22 @@ public void testGetAllInboundProtocols() throws IOException { "Response of the get all inbound protocols doesn't match."); } - /* This test is being temporarily commented out because the order of the elements change in the json - response payload which fails the test. But this has been manually verified. */ - // @Test - // public void testGetOIDCMetadata() throws IOException { - - // Response response = getResponseOfGet(METADATA_API_BASE_PATH + - // PATH_SEPARATOR + INBOUND_PROTOCOLS_PATH + - // PATH_SEPARATOR + OIDC_PATH); - // response.then() - // .log() - // .ifValidationFails() - // .assertThat() - // .statusCode(HttpStatus.SC_OK); - // ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory()); - // OIDCMetaData responseFound = jsonWriter.readValue(response.asString(), OIDCMetaData.class); - // Assert.assertEquals(sortScopeValidators(responseFound).toString(), oidcMetaData.toString(), - // "OIDC Metadata returned from the API doesn't match."); - // } - - private OIDCMetaData sortScopeValidators(OIDCMetaData oidcMetaData) { - - List scopeValidators = oidcMetaData.getScopeValidators().getOptions(); - Collections.sort(scopeValidators); - oidcMetaData.getScopeValidators().setOptions(scopeValidators); - return oidcMetaData; - } + @Test + public void testGetOIDCMetadata() throws IOException { + + Response response = getResponseOfGet(METADATA_API_BASE_PATH + + PATH_SEPARATOR + INBOUND_PROTOCOLS_PATH + + PATH_SEPARATOR + OIDC_PATH); + response.then() + .log() + .ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK); + ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory()); + OIDCMetaData responseFound = jsonWriter.readValue(response.asString(), OIDCMetaData.class); + Assert.assertEquals(responseFound.toString(), oidcMetaData.toString(), + "OIDC Metadata returned from the API doesn't match."); + } @Test public void testGetSAMLMetadata() throws IOException { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/OIDCMetaData.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/OIDCMetaData.java index e3ebae5ca76..39e29e04c26 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/OIDCMetaData.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/OIDCMetaData.java @@ -19,6 +19,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; +import java.util.Collections; +import java.util.Comparator; import java.util.Objects; import javax.validation.Valid; @@ -395,8 +397,8 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.tokenEndpointSignatureAlgorithm, oiDCMetaData.requestObjectSignatureAlgorithm) && Objects.equals(this.tokenEndpointSignatureAlgorithm, oiDCMetaData.requestObjectEncryptionAlgorithm) && Objects.equals(this.tokenEndpointSignatureAlgorithm, oiDCMetaData.requestObjectEncryptionMethod) && - Objects.equals(this.subjectType, oiDCMetaData.subjectType) && - Objects.equals(this.fapiMetadata, oiDCMetaData.fapiMetadata); + Objects.equals(this.subjectType, oiDCMetaData.subjectType) && + Objects.equals(this.fapiMetadata, oiDCMetaData.fapiMetadata); } @Override @@ -412,6 +414,7 @@ public int hashCode() { @Override public String toString() { + sort(); StringBuilder sb = new StringBuilder(); sb.append("class OIDCMetaData {\n"); @@ -432,6 +435,7 @@ public String toString() { sb.append(" requestObjectEncryptionAlgorithm: ").append(toIndentedString(requestObjectEncryptionAlgorithm)).append("\n"); sb.append(" requestObjectEncryptionMethod: ").append(toIndentedString(requestObjectEncryptionMethod)).append("\n"); sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); + sb.append(" fapiMetadata: ").append(toIndentedString(fapiMetadata)).append("\n"); sb.append("}"); return sb.toString(); } @@ -447,4 +451,27 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n"); } + + private void sort() { + + Comparator authMethodByName = Comparator + .comparing(ClientAuthenticationMethod::getName); + Comparator grantByName = Comparator.comparing(GrantType::getName); + allowedGrantTypes.getOptions().sort(grantByName); + tokenEndpointAuthMethod.getOptions().sort(authMethodByName); + fapiMetadata.getTokenEndpointAuthMethod().getOptions().sort(authMethodByName); + Collections.sort(idTokenEncryptionAlgorithm.getOptions()); + Collections.sort(idTokenEncryptionMethod.getOptions()); + Collections.sort(scopeValidators.getOptions()); + Collections.sort(accessTokenType.getOptions()); + Collections.sort(accessTokenBindingType.getOptions()); + Collections.sort(tokenEndpointSignatureAlgorithm.getOptions()); + Collections.sort(idTokenSignatureAlgorithm.getOptions()); + Collections.sort(requestObjectSignatureAlgorithm.getOptions()); + Collections.sort(requestObjectEncryptionAlgorithm.getOptions()); + Collections.sort(requestObjectEncryptionMethod.getOptions()); + Collections.sort(subjectType.getOptions()); + Collections.sort(fapiMetadata.getAllowedSignatureAlgorithms().getOptions()); + Collections.sort(fapiMetadata.getAllowedEncryptionAlgorithms().getOptions()); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/application/management/v1/oidc-metadata.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/application/management/v1/oidc-metadata.json index 9047ee63240..55581391a5f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/application/management/v1/oidc-metadata.json +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/application/management/v1/oidc-metadata.json @@ -90,7 +90,8 @@ "None", "cookie", "sso-session", - "device-flow" + "device-flow", + "certificate" ], "defaultValue": "None" }, diff --git a/pom.xml b/pom.xml index d4afbf4c541..30722758832 100755 --- a/pom.xml +++ b/pom.xml @@ -2435,7 +2435,7 @@ 2.0.13 1.3.25 - 1.2.118 + 1.2.119 5.5.9 5.5.7