diff --git a/jans-auth-server/client/src/test/java/io/jans/as/client/BaseTest.java b/jans-auth-server/client/src/test/java/io/jans/as/client/BaseTest.java index 6f597aea180..157a7d97ba6 100644 --- a/jans-auth-server/client/src/test/java/io/jans/as/client/BaseTest.java +++ b/jans-auth-server/client/src/test/java/io/jans/as/client/BaseTest.java @@ -8,6 +8,7 @@ import com.google.common.collect.Maps; import io.jans.as.client.client.AssertBuilder; +import io.jans.as.client.client.Asserter; import io.jans.as.client.dev.HostnameVerifierType; import io.jans.as.client.page.AbstractPage; import io.jans.as.client.page.PageConfig; @@ -815,24 +816,7 @@ public void discovery(ITestContext context) throws Exception { OpenIdConfigurationResponse response = client.execOpenIdConfiguration(); showClient(client); - assertEquals(response.getStatus(), 200, "Unexpected response code"); - assertNotNull(response.getIssuer(), "The issuer is null"); - assertNotNull(response.getAuthorizationEndpoint(), "The authorizationEndpoint is null"); - assertNotNull(response.getTokenEndpoint(), "The tokenEndpoint is null"); - assertNotNull(response.getRevocationEndpoint(), "The revocationEndpoint is null"); - assertNotNull(response.getUserInfoEndpoint(), "The userInfoEndPoint is null"); - assertNotNull(response.getJwksUri(), "The jwksUri is null"); - assertNotNull(response.getRegistrationEndpoint(), "The registrationEndpoint is null"); - - assertTrue(response.getScopesSupported().size() > 0, "The scopesSupported is empty"); - assertTrue(response.getResponseTypesSupported().size() > 0, "The responseTypesSupported is empty"); - assertTrue(response.getGrantTypesSupported().size() > 0, "The grantTypesSupported is empty"); - assertTrue(response.getAcrValuesSupported().size() >= 0, "The acrValuesSupported is empty"); - assertTrue(response.getSubjectTypesSupported().size() > 0, "The subjectTypesSupported is empty"); - assertTrue(response.getIdTokenSigningAlgValuesSupported().size() > 0, "The idTokenSigningAlgValuesSupported is empty"); - assertTrue(response.getRequestObjectSigningAlgValuesSupported().size() > 0, "The requestObjectSigningAlgValuesSupported is empty"); - assertTrue(response.getTokenEndpointAuthMethodsSupported().size() > 0, "The tokenEndpointAuthMethodsSupported is empty"); - assertTrue(response.getClaimsSupported().size() > 0, "The claimsSupported is empty"); + Asserter.assertOpenIdConfigurationResponse(response); authorizationEndpoint = response.getAuthorizationEndpoint(); tokenEndpoint = response.getTokenEndpoint(); diff --git a/jans-auth-server/client/src/test/java/io/jans/as/client/client/Asserter.java b/jans-auth-server/client/src/test/java/io/jans/as/client/client/Asserter.java index d58c9e693f7..3114e504e0e 100644 --- a/jans-auth-server/client/src/test/java/io/jans/as/client/client/Asserter.java +++ b/jans-auth-server/client/src/test/java/io/jans/as/client/client/Asserter.java @@ -6,13 +6,13 @@ package io.jans.as.client.client; +import io.jans.as.client.OpenIdConfigurationResponse; import io.jans.as.client.RegisterResponse; import io.jans.as.model.register.RegisterRequestParam; import java.util.Arrays; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.*; /** * @author Yuriy Zabrovarnyy @@ -49,4 +49,31 @@ public static void assertRegisterResponseClaimsAreContained(RegisterResponse res assertTrue(response.getClaims().containsKey(claim.toString()), "Claim " + claim + " is not contained in response claims - code" + response.getEntity()); } } + + public static void assertOpenIdConfigurationResponse(OpenIdConfigurationResponse response) { + assertEquals(response.getStatus(), 200, "Unexpected response code"); + assertNotNull(response.getIssuer(), "The issuer is null"); + assertNotNull(response.getAuthorizationEndpoint(), "The authorizationEndpoint is null"); + assertNotNull(response.getTokenEndpoint(), "The tokenEndpoint is null"); + assertNotNull(response.getRevocationEndpoint(), "The tokenRevocationEndpoint is null"); + assertNotNull(response.getUserInfoEndpoint(), "The userInfoEndPoint is null"); + assertNotNull(response.getClientInfoEndpoint(), "The clientInfoEndPoint is null"); + assertNotNull(response.getCheckSessionIFrame(), "The checkSessionIFrame is null"); + assertNotNull(response.getEndSessionEndpoint(), "The endSessionEndpoint is null"); + assertNotNull(response.getJwksUri(), "The jwksUri is null"); + assertNotNull(response.getRegistrationEndpoint(), "The registrationEndpoint is null"); + assertNotNull(response.getIntrospectionEndpoint(), "The introspectionEndpoint is null"); + assertNotNull(response.getParEndpoint(), "The parEndpoint is null"); + + assertTrue(response.getScopesSupported().size() > 0, "The scopesSupported is empty"); + assertTrue(response.getResponseTypesSupported().size() > 0, "The responseTypesSupported is empty"); + assertTrue(response.getGrantTypesSupported().size() > 0, "The grantTypesSupported is empty"); + assertTrue(response.getSubjectTypesSupported().size() > 0, "The subjectTypesSupported is empty"); + assertTrue(response.getIdTokenSigningAlgValuesSupported().size() > 0, "The idTokenSigningAlgValuesSupported is empty"); + assertTrue(response.getRequestObjectSigningAlgValuesSupported().size() > 0, "The requestObjectSigningAlgValuesSupported is empty"); + assertTrue(response.getTokenEndpointAuthMethodsSupported().size() > 0, "The tokenEndpointAuthMethodsSupported is empty"); + assertTrue(response.getTokenEndpointAuthSigningAlgValuesSupported().size() > 0, "The tokenEndpointAuthSigningAlgValuesSupported is empty"); + assertTrue(response.getClaimsSupported().size() > 0, "The claimsSupported is empty"); + + } } diff --git a/jans-auth-server/client/src/test/java/io/jans/as/client/ws/rs/ConfigurationRestWebServiceHttpTest.java b/jans-auth-server/client/src/test/java/io/jans/as/client/ws/rs/ConfigurationRestWebServiceHttpTest.java index 5e66d619f6f..acb608d3d35 100644 --- a/jans-auth-server/client/src/test/java/io/jans/as/client/ws/rs/ConfigurationRestWebServiceHttpTest.java +++ b/jans-auth-server/client/src/test/java/io/jans/as/client/ws/rs/ConfigurationRestWebServiceHttpTest.java @@ -11,6 +11,7 @@ import io.jans.as.client.OpenIdConfigurationResponse; import io.jans.as.client.OpenIdConnectDiscoveryClient; import io.jans.as.client.OpenIdConnectDiscoveryResponse; +import io.jans.as.client.client.Asserter; import io.jans.as.client.dev.HostnameVerifierType; import org.apache.http.impl.client.CloseableHttpClient; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine; @@ -62,26 +63,10 @@ public void requestOpenIdConfiguration(final String resource) throws Exception { OpenIdConfigurationResponse response = client.execOpenIdConfiguration(); showClient(client); - assertEquals(response.getStatus(), 200, "Unexpected response code"); - assertNotNull(response.getIssuer(), "The issuer is null"); - assertNotNull(response.getAuthorizationEndpoint(), "The authorizationEndpoint is null"); - assertNotNull(response.getTokenEndpoint(), "The tokenEndpoint is null"); - assertNotNull(response.getRevocationEndpoint(), "The tokenRevocationEndpoint is null"); - assertNotNull(response.getUserInfoEndpoint(), "The userInfoEndPoint is null"); - assertNotNull(response.getClientInfoEndpoint(), "The clientInfoEndPoint is null"); - assertNotNull(response.getCheckSessionIFrame(), "The checkSessionIFrame is null"); - assertNotNull(response.getEndSessionEndpoint(), "The endSessionEndpoint is null"); - assertNotNull(response.getJwksUri(), "The jwksUri is null"); - assertNotNull(response.getRegistrationEndpoint(), "The registrationEndpoint is null"); - assertNotNull(response.getIntrospectionEndpoint(), "The introspectionEndpoint is null"); - assertNotNull(response.getParEndpoint(), "The parEndpoint is null"); - - assertTrue(response.getScopesSupported().size() > 0, "The scopesSupported is empty"); - assertTrue(response.getScopeToClaimsMapping().size() > 0, "The scope to claims mapping is empty"); - assertTrue(response.getResponseTypesSupported().size() > 0, "The responseTypesSupported is empty"); + Asserter.assertOpenIdConfigurationResponse(response); + assertTrue(response.getResponseModesSupported().size() > 0, "The responseModesSupported is empty"); assertTrue(response.getGrantTypesSupported().size() > 0, "The grantTypesSupported is empty"); - assertTrue(response.getAcrValuesSupported().size() >= 0, "The acrValuesSupported is empty"); assertTrue(response.getSubjectTypesSupported().size() > 0, "The subjectTypesSupported is empty"); assertTrue(response.getUserInfoSigningAlgValuesSupported().size() > 0, "The userInfoSigningAlgValuesSupported is empty"); assertTrue(response.getUserInfoEncryptionAlgValuesSupported().size() > 0, "The userInfoEncryptionAlgValuesSupported is empty"); @@ -92,12 +77,9 @@ public void requestOpenIdConfiguration(final String resource) throws Exception { assertTrue(response.getRequestObjectSigningAlgValuesSupported().size() > 0, "The requestObjectSigningAlgValuesSupported is empty"); assertTrue(response.getRequestObjectEncryptionAlgValuesSupported().size() > 0, "The requestObjectEncryptionAlgValuesSupported is empty"); assertTrue(response.getRequestObjectEncryptionEncValuesSupported().size() > 0, "The requestObjectEncryptionEncValuesSupported is empty"); - assertTrue(response.getTokenEndpointAuthMethodsSupported().size() > 0, "The tokenEndpointAuthMethodsSupported is empty"); - assertTrue(response.getTokenEndpointAuthSigningAlgValuesSupported().size() > 0, "The tokenEndpointAuthSigningAlgValuesSupported is empty"); assertTrue(response.getDisplayValuesSupported().size() > 0, "The displayValuesSupported is empty"); assertTrue(response.getClaimTypesSupported().size() > 0, "The claimTypesSupported is empty"); - assertTrue(response.getClaimsSupported().size() > 0, "The claimsSupported is empty"); assertNotNull(response.getServiceDocumentation(), "The serviceDocumentation is null"); assertTrue(response.getClaimsLocalesSupported().size() > 0, "The claimsLocalesSupported is empty"); assertTrue(response.getUiLocalesSupported().size() > 0, "The uiLocalesSupported is empty"); @@ -105,8 +87,6 @@ public void requestOpenIdConfiguration(final String resource) throws Exception { assertTrue(response.getRequestParameterSupported(), "The requestParameterSupported is false"); assertTrue(response.getRequestUriParameterSupported(), "The requestUriParameterSupported is false"); assertFalse(response.getRequireRequestUriRegistration(), "The requireRequestUriRegistration is true"); - assertNotNull(response.getOpPolicyUri(), "The opPolicyUri is null"); - assertNotNull(response.getOpTosUri(), "The opTosUri is null"); // Jans Auth #917: Add dynamic scopes and claims to discovery Map> scopeToClaims = response.getScopeToClaimsMapping();