diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/common/RESTTestBase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/common/RESTTestBase.java index e6ffcb5ff8..9c35ada9f7 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/common/RESTTestBase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/common/RESTTestBase.java @@ -674,6 +674,27 @@ protected Response getResponseOfPut(String endpointUri, String body) { .put(endpointUri); } + /** + * Invoke given endpointUri for PUT with given body and Basic authentication, authentication credential being the + * authenticatingUserName and authenticatingCredential + * This implementation does not incorporate any additional filters. + * + * @param endpointUri endpoint to be invoked + * @param body payload + * @return response + */ + protected Response getResponseOfPutWithNoFilter(String endpointUri, String body) { + + return given().auth().preemptive().basic(authenticatingUserName, authenticatingCredential) + .contentType(ContentType.JSON) + .header(HttpHeaders.ACCEPT, ContentType.JSON) + .body(body) + .log().ifValidationFails() + .when() + .log().ifValidationFails() + .put(endpointUri); + } + /** * Invoke given endpointUri for PUT with given body and Basic authentication, authentication credential being the * authenticatingUserName and authenticatingCredential diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPFailureTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPFailureTest.java index 807984c959..56398a9e26 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPFailureTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPFailureTest.java @@ -17,6 +17,7 @@ package org.wso2.identity.integration.test.rest.api.server.idp.v1; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import io.restassured.response.Response; import org.apache.commons.lang.StringUtils; @@ -56,6 +57,10 @@ public class IdPFailureTest extends IdPTestBase { private static final String FEDERATED_AUTHENTICATOR_PLACEHOLDER_1 = "\"\""; private static final String FEDERATED_AUTHENTICATOR_PLACEHOLDER_2 = "\"\""; private static final String IDP_NAME_PLACEHOLDER = ""; + private static final String OIDC_IDP_NAME_PLACEHOLDER = ""; + private static final String METADATA_SAML_PLACEHOLDER = ""; + private static final String OIDC_SCOPES_PLACEHOLDER = "\"\""; + private static final String AUTHENTICATOR_PROPERTIES_PLACEHOLDER = "\"\""; private static final String CUSTOM_IDP_NAME = "CustomAuthIDP"; private static final String USER_DEFINED_AUTHENTICATOR_ID_1 = "Y3VzdG9tQXV0aGVudGljYXRvcjE="; private static final String USER_DEFINED_AUTHENTICATOR_ID_2 = "Y3VzdG9tQXV0aGVudGljYXRvcg=="; @@ -140,6 +145,24 @@ public void addIdPWithDuplicateProperties() throws IOException { validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "IDP-60025"); } + @Test + public void testAddIdPWithDuplicatedPropertyKeys() throws IOException { + + String addIdpPayload = readResource("add-idp.json"); + String duplicatedProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("username","admin"), + createAuthenticatorProperties("username", "adminTest")); + String body = addIdpPayload.replace(AUTHENTICATOR_PROPERTIES_PLACEHOLDER, duplicatedProperties); + + Response response = getResponseOfPost(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_BAD_REQUEST) + .body("message", equalTo("Invalid input.")) + .body("description", equalTo("One of the given inputs is invalid. Duplicate properties are " + + "found in the request.")); + } @Test(dependsOnMethods = {"addIdPConflict"}) public void testGetIdPFederatedAuthenticatorWithInvalidAuthId() { @@ -547,8 +570,13 @@ private Response createUserDefAuthenticator(String idpName, UserDefinedAuthentic @Test public void testUpdateIdPWithDuplicateOIDCScopes() throws IOException { - String body = readResource("add-idp-oidc-standard-based.json"); - Response response = getResponseOfPost(IDP_API_BASE_PATH, body); + String oidcIdpPayload = readResource("add-oidc-idp.json"); + String oidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","openid country profile"), null); + String body = oidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, oidcScopesProperties); + body = body.replace(OIDC_IDP_NAME_PLACEHOLDER, "OIDC-IdP-3"); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); response.then() .log().ifValidationFails() .assertThat() @@ -561,8 +589,13 @@ public void testUpdateIdPWithDuplicateOIDCScopes() throws IOException { assertNotNull(oidcIdPId); // update the OIDC IDP with duplicated scopes - String updateBody = readResource("update-idp-oidc-standard-based-duplicated-scopes.json"); - Response updateResponse = getResponseOfPut(IDP_API_BASE_PATH + PATH_SEPARATOR + oidcIdPId + + String updateOidcIdpPayload = readResource("update-oidc-idp.json"); + String updateOidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","openid country profile"), + createAuthenticatorProperties("commonAuthQueryParams","scope=openid country profile")); + String updateBody = updateOidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, updateOidcScopesProperties); + + Response updateResponse = getResponseOfPutWithNoFilter(IDP_API_BASE_PATH + PATH_SEPARATOR + oidcIdPId + PATH_SEPARATOR + IDP_FEDERATED_AUTHENTICATORS_PATH + PATH_SEPARATOR + OIDC_IDP_ID, updateBody); updateResponse.then() .log().ifValidationFails() @@ -575,6 +608,60 @@ public void testUpdateIdPWithDuplicateOIDCScopes() throws IOException { deleteCreatedIdP(oidcIdPId); } + @Test(dependsOnMethods = "testUpdateIdPWithDuplicateOIDCScopes") + public void testUpdateOIDCIdPWithoutOpenidScope() throws IOException { + + String oidcIdpPayload = readResource("add-oidc-idp.json"); + String oidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","openid country profile"), null); + String body = oidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, oidcScopesProperties); + body = body.replace(OIDC_IDP_NAME_PLACEHOLDER, "OIDC-IdP-4"); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_CREATED) + .header(HttpHeaders.LOCATION, notNullValue()); + + String location = response.getHeader(HttpHeaders.LOCATION); + assertNotNull(location); + String oidcIdPId = location.substring(location.lastIndexOf("/") + 1); + assertNotNull(oidcIdPId); + + // update the OIDC IdP without openid scope + String updateOidcIdpPayload = readResource("update-oidc-idp.json"); + String updateOidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","country profile"), null); + String updateBody = updateOidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, updateOidcScopesProperties); + + Response updateResponse = getResponseOfPutWithNoFilter(IDP_API_BASE_PATH + PATH_SEPARATOR + oidcIdPId + + PATH_SEPARATOR + IDP_FEDERATED_AUTHENTICATORS_PATH + PATH_SEPARATOR + OIDC_IDP_ID, updateBody); + updateResponse.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_BAD_REQUEST) + .body("message", equalTo("Invalid OIDC Scopes.")) + .body("description", equalTo("Scopes must contain 'openid'.")); + + deleteCreatedIdP(oidcIdPId); + } + + @Test + public void addSamlIdPWithoutMetadata() throws IOException { + + String samlIdpPayload = readResource("add-saml-idp.json"); + String body = samlIdpPayload.replace(METADATA_SAML_PLACEHOLDER, ""); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_BAD_REQUEST) + .body("message", equalTo("Invalid SAML metadata.")) + .body("description", equalTo("SAML metadata is invalid/empty.")); + } + /** * Deletes an Identity Provider by its ID and verifies the deletion. * @@ -597,4 +684,39 @@ private void deleteCreatedIdP(String idPId) { .body("description", equalTo("Unable to find a resource matching the provided identity " + "provider identifier " + idPId + ".")); } + + /** + * Creates a map of authenticator properties with a provided key and value. + * + * @param key Authenticator key. + * @param value Authenticator value. + * @return a map containing the authenticator properties. + */ + private Map createAuthenticatorProperties(String key, String value) { + + Map authenticatorProps = new HashMap<>(); + authenticatorProps.put("key", key); + authenticatorProps.put("value", value); + return authenticatorProps; + } + + /** + * Converts a map of properties and an optional map of duplicated properties into a JSON string. + * If duplicated properties are provided, they are appended to the JSON string of the original properties. + * + * @param properties Main map of properties. + * @param duplicatedProperties Map of duplicated properties. + * @return a JSON string representation of the properties and duplicated properties. + * @throws JsonProcessingException if there is an error during JSON conversion. + */ + private String convertDuplicatedPropertiesToJson(Map properties, + Map duplicatedProperties) + throws JsonProcessingException { + + ObjectMapper objectMapper = new ObjectMapper(); + if (duplicatedProperties != null) { + return objectMapper.writeValueAsString(properties) + "," + objectMapper.writeValueAsString(duplicatedProperties); + } + return objectMapper.writeValueAsString(properties); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPSuccessTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPSuccessTest.java index b238dc337b..c4b59dd883 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPSuccessTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/idp/v1/IdPSuccessTest.java @@ -17,12 +17,13 @@ package org.wso2.identity.integration.test.rest.api.server.idp.v1; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import io.restassured.response.Response; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; -import org.hamcrest.Matcher; +import org.hamcrest.Matchers; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; @@ -57,6 +58,10 @@ public class IdPSuccessTest extends IdPTestBase { private static final String FEDERATED_AUTHENTICATOR_ID_PLACEHOLDER = ""; private static final String FEDERATED_AUTHENTICATOR_PLACEHOLDER = "\"\""; private static final String IDP_NAME_PLACEHOLDER = ""; + private static final String OIDC_IDP_NAME_PLACEHOLDER = ""; + private static final String METADATA_SAML_PLACEHOLDER = ""; + private static final String OIDC_SCOPES_PLACEHOLDER = "\"\""; + private static final String AUTHENTICATOR_PROPERTIES_PLACEHOLDER = "\"\""; private static final String FEDERATED_AUTHENTICATOR_ID = "Y3VzdG9tQXV0aGVudGljYXRvcg"; private static final String CUSTOM_IDP_NAME = "Custom Auth IDP"; private static final String ENDPOINT_URI = "https://abc.com/authenticate"; @@ -69,12 +74,14 @@ public class IdPSuccessTest extends IdPTestBase { private static final String PASSWORD_VALUE = "testPassword"; private static final String IDP_NAME = "Google"; private static final String TRUSTED_TOKEN_ISS_IDP_NAME = "Trusted Token Issuer IdP"; + private static final String AUTHENTICATOR_NAME = "GoogleOIDCAuthenticator"; + private static final String DEFINED_BY_SYSTEM = "SYSTEM"; + private UserDefinedAuthenticatorPayload userDefinedAuthenticatorPayload; + private String idpCreatePayload; private String idPId; private String trustedTokenIdPId; private String customIdPId; private String idPTemplateId; - private UserDefinedAuthenticatorPayload userDefinedAuthenticatorPayload; - private String idpCreatePayload; @Factory(dataProvider = "restAPIUserConfigProvider") public IdPSuccessTest(TestUserMode userMode) throws Exception { @@ -414,7 +421,11 @@ public void testDeleteIdPWithUserDefinedAuthenticator() { @Test(dependsOnMethods = {"testGetMetaOutboundConnector"}) public void testAddIdP() throws IOException { - String body = readResource("add-idp.json"); + String addIdpPayload = readResource("add-idp.json"); + String properties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("username","admin"), null); + String body = addIdpPayload.replace(AUTHENTICATOR_PROPERTIES_PLACEHOLDER, properties); + Response response = getResponseOfPost(IDP_API_BASE_PATH, body); response.then() .log().ifValidationFails() @@ -428,6 +439,106 @@ public void testAddIdP() throws IOException { assertNotNull(idPId); } + @Test() + public void addIdPWithoutAuthenticator() throws IOException { + + String body = readResource("add-idp-without-authenticator.json"); + Response response = getResponseOfPost(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_CREATED) + .body("federatedAuthenticators.authenticators", Matchers.emptyIterable()) + .header(HttpHeaders.LOCATION, notNullValue()); + + String location = response.getHeader(HttpHeaders.LOCATION); + assertNotNull(location); + String idpIdWithoutAuth = location.substring(location.lastIndexOf("/") + 1); + assertNotNull(idpIdWithoutAuth); + + deleteCreatedIdP(idpIdWithoutAuth); + } + + + /* This test method has been added in order to test the current behaviour. + * There seem to be some concerns related to internal validations used in functionality associated with this. + * This is being tracked with the issue: https://github.com/wso2/product-is/issues/21928 + */ + @Test + public void addIdPWithDuplicatedOIDCScopes() throws IOException { + + String oidcIdpPayload = readResource("add-oidc-idp.json"); + String oidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","openid country profile"), + createAuthenticatorProperties("commonAuthQueryParams","scope=openid country profile")); + String body = oidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, oidcScopesProperties); + body = body.replace(OIDC_IDP_NAME_PLACEHOLDER, "OIDC-IdP-1"); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_CREATED) + .header(HttpHeaders.LOCATION, notNullValue()); + + String location = response.getHeader(HttpHeaders.LOCATION); + assertNotNull(location); + String oidcIdpId = location.substring(location.lastIndexOf("/") + 1); + assertNotNull(oidcIdpId); + + deleteCreatedIdP(oidcIdpId); + } + + /* This test method has been added in order to test the current behaviour. + * There seem to be some concerns related to internal validations used in functionality associated with this. + * This is being tracked with the issue: https://github.com/wso2/product-is/issues/21928 + */ + @Test(dependsOnMethods = "addIdPWithDuplicatedOIDCScopes") + public void addOIDCIdPWithoutOpenidScope() throws IOException { + + String oidcIdpPayload = readResource("add-oidc-idp.json"); + String oidcScopesProperties = convertDuplicatedPropertiesToJson( + createAuthenticatorProperties("Scopes","country profile"), null); + String body = oidcIdpPayload.replace(OIDC_SCOPES_PLACEHOLDER, oidcScopesProperties); + body = body.replace(OIDC_IDP_NAME_PLACEHOLDER, "OIDC-IdP-2"); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_CREATED) + .header(HttpHeaders.LOCATION, notNullValue()); + + String location = response.getHeader(HttpHeaders.LOCATION); + assertNotNull(location); + String oidcIdpId = location.substring(location.lastIndexOf("/") + 1); + assertNotNull(oidcIdpId); + + deleteCreatedIdP(oidcIdpId); + } + + @Test + public void addSAMLStandardBasedIdP() throws IOException { + + String samlIdpPayload = readResource("add-saml-idp.json"); + String body = samlIdpPayload.replace(METADATA_SAML_PLACEHOLDER, loadMetadataSamlFile( + "test-metadata-saml.xml")); + + Response response = getResponseOfPostNoFilter(IDP_API_BASE_PATH, body); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_CREATED) + .header(HttpHeaders.LOCATION, notNullValue()); + + String location = response.getHeader(HttpHeaders.LOCATION); + assertNotNull(location); + String samlIdpId = location.substring(location.lastIndexOf("/") + 1); + assertNotNull(samlIdpId); + + deleteCreatedIdP(samlIdpId); + } + @Test(dependsOnMethods = {"testAddIdP"}) public void testGetIdP() throws IOException { @@ -489,6 +600,19 @@ public void testSearchAllIdPs() throws XPathExpressionException { context.getContextTenant().getDomain()))); } + @Test + public void testSearchIdPByNonExistentIdPName() { + + Response response = getResponseOfGetWithQueryParams(IDP_API_BASE_PATH, Collections.singletonMap("filter", + "name sw InvalidIdP")); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("totalResults", equalTo(0)) + .body("count", equalTo(0)); + } + @Test(dependsOnMethods = {"testGetIdPs"}) public void testGetIdPsWithRequiredAttribute() throws Exception { @@ -540,7 +664,7 @@ public void testUpdateIdPFederatedAuthenticator() throws IOException { .log().ifValidationFails() .assertThat() .statusCode(HttpStatus.SC_OK) - .body("definedBy", equalTo("SYSTEM")); + .body("definedBy", equalTo(DEFINED_BY_SYSTEM)); } @Test(dependsOnMethods = {"testUpdateIdPFederatedAuthenticator"}) @@ -557,7 +681,7 @@ public void testGetIdPFederatedAuthenticator() throws IOException { .body("isEnabled", equalTo(true)) .body("isDefault", equalTo(true)) .body("properties", notNullValue()) - .body("definedBy", equalTo("SYSTEM")) + .body("definedBy", equalTo(DEFINED_BY_SYSTEM)) .body("properties.find{ it.key == 'ClientId' }.value", equalTo ("165474950684-7mvqd8m6hieb8mdnffcarnku2aua0tpl.apps.googleusercontent.com")) .body("properties.find{ it.key == 'ClientSecret' }.value", equalTo("testclientsecret")) @@ -789,7 +913,21 @@ public void testPatchIdP() throws IOException { .body("certificate.certificates", nullValue()); } - @Test(dependsOnMethods = {"testPatchIdP"}) + @Test(dependsOnMethods = "testPatchIdP") + public void testExportIDPToFile() { + + Response response = getResponseOfGet(IDP_API_BASE_PATH + PATH_SEPARATOR + idPId + PATH_SEPARATOR + + "export"); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("identityProviderName", equalTo(IDP_NAME)) + .body("federatedAuthenticatorConfigs.find { it.name == '" + AUTHENTICATOR_NAME + "' }.definedByType", + equalTo(DEFINED_BY_SYSTEM)); + } + + @Test(dependsOnMethods = {"testExportIDPToFile"}) public void testDeleteIdP() { getResponseOfDelete(IDP_API_BASE_PATH + PATH_SEPARATOR + idPId) @@ -920,6 +1058,76 @@ public void testDeleteIdPTemplate() throws Exception { .statusCode(HttpStatus.SC_NO_CONTENT); } + /** + * Deletes an Identity Provider by its ID and verifies the deletion. + * + * @param idPId ID of the Identity Provider to be deleted. + */ + private void deleteCreatedIdP(String idPId) { + + Response response = getResponseOfDelete(IDP_API_BASE_PATH + PATH_SEPARATOR + idPId); + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_NO_CONTENT); + + Response responseOfGet = getResponseOfGet(IDP_API_BASE_PATH + PATH_SEPARATOR + idPId); + responseOfGet.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_NOT_FOUND) + .body("message", equalTo("Resource not found.")) + .body("description", equalTo("Unable to find a resource matching the provided identity " + + "provider identifier " + idPId + ".")); + } + + /** + * Load saml metadata content from the provided file. + * + * @return content of file as String + * @throws IOException if an error occurred while reading the file. + */ + private String loadMetadataSamlFile(String xmlFileName) throws IOException { + + String metadata = readResource(xmlFileName); + return new String(Base64.getEncoder().encode(metadata.getBytes())); + } + + /** + * Creates a map of authenticator properties with a provided key and value. + * + * @param key Authenticator key. + * @param value Authenticator value. + * @return a map containing the authenticator properties. + */ + private Map createAuthenticatorProperties(String key, String value) { + + Map authenticatorProps = new HashMap<>(); + authenticatorProps.put("key", key); + authenticatorProps.put("value", value); + return authenticatorProps; + } + + /** + * Converts a map of properties and an optional map of duplicated properties into a JSON string. + * If duplicated properties are provided, they are appended to the JSON string of the original properties. + * + * @param properties Main map of properties. + * @param duplicatedProperties Map of duplicated properties. + * @return a JSON string representation of the properties and duplicated properties. + * @throws JsonProcessingException if there is an error during JSON conversion. + */ + private String convertDuplicatedPropertiesToJson(Map properties, + Map duplicatedProperties) + throws JsonProcessingException { + + ObjectMapper objectMapper = new ObjectMapper(); + if (duplicatedProperties != null) { + return objectMapper.writeValueAsString(properties) + "," + objectMapper.writeValueAsString(duplicatedProperties); + } + return objectMapper.writeValueAsString(properties); + } + @Test public void testAddTrustedTokenIssuerIdP() throws IOException { diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-without-authenticator.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-without-authenticator.json new file mode 100644 index 0000000000..c7b1f1bc61 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-without-authenticator.json @@ -0,0 +1,77 @@ +{ + "name": "Google-3", + "description": "IDP for Google Federation", + "image": "google-logo-url", + "isPrimary": false, + "isFederationHub": false, + "homeRealmIdentifier": "localhost", + "certificate": { + "certificates": [ + "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURzRENDQXBpZ0F3SUJBZ0lKQUs0eml2ckVsYzBJTUEwR0NTcUdTSWIzRFFFQkN3VUFNSUdETVJFd0R3WUQKVlFRRERBaENkV1JrYUdsdFlURUxNQWtHQTFVRUJoTUNVMHd4RURBT0JnTlZCQWdNQjFkbGMzUmxjbTR4RURBTwpCZ05WQkFjTUIwTnZiRzl0WW04eERUQUxCZ05WQkFvTUJGZFRUekl4Q3pBSkJnTlZCQXNNQWxGQk1TRXdId1lKCktvWklodmNOQVFrQkZoSmlkV1JrYUdsdFlYVkFkM052TWk1amIyMHdJQmNOTVRrd056RTJNRFF5TXpFd1doZ1AKTXpBeE9ERXhNVFl3TkRJek1UQmFNSUdETVJFd0R3WURWUVFEREFoQ2RXUmthR2x0WVRFTE1Ba0dBMVVFQmhNQwpVMHd4RURBT0JnTlZCQWdNQjFkbGMzUmxjbTR4RURBT0JnTlZCQWNNQjBOdmJHOXRZbTh4RFRBTEJnTlZCQW9NCkJGZFRUekl4Q3pBSkJnTlZCQXNNQWxGQk1TRXdId1lKS29aSWh2Y05BUWtCRmhKaWRXUmthR2x0WVhWQWQzTnYKTWk1amIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFDcFo3V09VMTZpeGpiQwpiWGR3R3JhTW5xbmxnb2kzMDN5aVFxbHAySzlWTmZHT21nTlFhdFdlbjB0MVVWcjYxd0Y4eVlHaDJyc1lnbithCjhwYXVmUVVQQ1laeFRFR1FpT2RPZ0RNcE5tWW82ZHU2K2MvenJqcHNncGh5SHIxNEZPVHAxaVRDSXBmanVwVjEKd1BUeXJveURySGRvMkpuOHI3V3F1cklJVTRBYllBN2NrdVVqL0tqYUovTTZrZitwRFd5SVJvaDBKTFJlWWM4UQp5bmhYcjdrQWp5RnFqNitnWndBYkh4ckhrckVzYTJoVjQ0UFJXWjFQUERxTCswVU8veE1hQW5udndsdGd4QlVpCkhLUTFXWDVwdVVPaC9kQTQ5b0RsbEpraHpxd2d5eDQxc1FYbFNhVmdKaklUZVdSQmdvNnh6ajNmd3VvenBGS1gKbzRaeXBITDNBZ01CQUFHakl6QWhNQjhHQTFVZEVRUVlNQmFDQkhkemJ6S0NDSGR6YnpJdVkyOXRnZ1IzYzI4eQpNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUJBUUJTSzBKa1pyYlpvYmRDNHhZSG1IcnlVbkZVbkZZWUFvZmc0TFVGCkJRbWxDY0NKR0ZwR1BtN2ZDWHM0Y0h4Z0hPVTN5SkhtQ2pYaU9FRTc2dzhIU0NRcVhkNmROSEwxRkxtN0pqQTUKTEZmbHhiWXNOcmVVNVpJTmREVGZvWmxSSXR0Mkd4MlpIa3pjQVRJZm1yUFNwODV2WDhGem1mbTNBVTVpM3FXZQo4a2YyZk5nQjlMbE5XRFk1V09paVlHUWMrRk13WWdLcDJkNGM3dzMrWnRTUXJWRy9YdGpqYTJYV09Xdm1sV3dLCnB4b3pyNjIvTTdUUmVkc3hJNU90bzJvWExGZXp1MUdCWHdpNEFaempMSFVsNWpSR2hMbkNZa05qdWZGZi9EQ0cKeUFWdnpMVXQwZ2F0b0dJdTV2eG9la05JVWV5YTZpRzJBaG9jSmM0SEJMT3l4TXE3Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" + ] + }, + "alias": "https://localhost:9444/oauth2/token", + "claims": { + "userIdClaim": { + "uri": "http://wso2.org/claims/username" + }, + "roleClaim": { + "uri": "http://wso2.org/claims/role" + }, + "provisioningClaims": [ + { + "claim": { + "uri": "http://wso2.org/claims/username" + }, + "defaultValue": "sathya" + } + ] + }, + "roles": { + "mappings": [ + { + "idpRole": "google-manager", + "localRole": "admin" + } + ], + "outboundProvisioningRoles": [ + "admin" + ] + }, + "provisioning": { + "jit": { + "isEnabled": true, + "scheme": "PROVISION_SILENTLY", + "userstore": "PRIMARY" + }, + "outboundConnectors": { + "defaultConnectorId": "c2NpbQ", + "connectors": [ + { + "connectorId": "c2NpbQ", + "isEnabled": true, + "blockingEnabled": false, + "rulesEnabled": false, + "properties": [ + { + "key": "scim-user-ep", + "value": "https://localhost:9445/userinfo" + }, + { + "key": "scim-username", + "value": "admin" + }, + { + "key": "scim-enable-pwd-provisioning", + "value": "true" + }, + { + "key": "scim-password", + "value": "admin" + } + ] + } + ] + } + } +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp.json index abe0d6c9f2..2c1291df23 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp.json +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp.json @@ -60,7 +60,8 @@ { "key": "callbackUrl", "value": "https://mydomain2.com:9443/commonauth" - } + }, + "" ] } ] diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-oidc-standard-based.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-oidc-idp.json similarity index 96% rename from modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-oidc-standard-based.json rename to modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-oidc-idp.json index 1d5831d257..bb4d02b7fc 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-idp-oidc-standard-based.json +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-oidc-idp.json @@ -1,5 +1,5 @@ { - "name": "OIDC IdP", + "name": "", "alias": "", "description": "Authenticate users with Enterprise OIDC connections.", "image": "assets/images/logos/enterprise.svg", @@ -30,6 +30,7 @@ "isEnabled": true, "authenticatorId": "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I", "properties": [ + "", { "key": "ClientId", "value": "abcd1234wxyz5678ijklmnopqrst9012" diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-saml-idp.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-saml-idp.json new file mode 100644 index 0000000000..a473267063 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/add-saml-idp.json @@ -0,0 +1,60 @@ +{ + "name": "SAML IdP", + "alias": "", + "description": "Authenticate users with Enterprise SAML connections.", + "image": "assets/images/logos/enterprise.svg", + "isPrimary": false, + "roles": { + "mappings": [], + "outboundProvisioningRoles": [] + }, + "certificate": { + "certificates": [ + "" + ] + }, + "claims": { + "userIdClaim": { + "uri": "" + }, + "provisioningClaims": [], + "roleClaim": { + "uri": "" + } + }, + "federatedAuthenticators": { + "defaultAuthenticatorId": "U0FNTFNTT0F1dGhlbnRpY2F0b3I", + "authenticators": [ + { + "isEnabled": true, + "authenticatorId": "U0FNTFNTT0F1dGhlbnRpY2F0b3I", + "properties": [ + { + "key": "SPEntityId", + "value": "https://test.idp.com" + }, + { + "key": "meta_data_saml", + "value": "" + }, + { + "key": "SelectMode", + "value": "Metadata File Configuration" + }, + { + "key": "IsUserIdInClaims", + "value": "false" + }, + { + "key": "IsSLORequestAccepted", + "value": "false" + } + ] + } + ] + }, + "homeRealmIdentifier": "", + "isFederationHub": false, + "idpIssuerName": "", + "templateId": "enterprise-saml-idp" +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/test-metadata-saml.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/test-metadata-saml.xml new file mode 100644 index 0000000000..3c83898a18 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/test-metadata-saml.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + Test Identity Provider + Test IdP + https://test.idp.com + + + + + Support Team + support@test.com + + diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-idp-oidc-standard-based-duplicated-scopes.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-idp-oidc-standard-based-duplicated-scopes.json deleted file mode 100644 index 701256b253..0000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-idp-oidc-standard-based-duplicated-scopes.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "authenticatorId": "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I", - "isEnabled": true, - "isDefault": true, - "properties": [ - { - "key": "commonAuthQueryParams", - "value": "scope=openid country profile" - }, - { - "key": "Scopes", - "value": "openid country profile" - } - ] -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-oidc-idp.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-oidc-idp.json new file mode 100644 index 0000000000..383a992414 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/idp/v1/update-oidc-idp.json @@ -0,0 +1,9 @@ +{ + "authenticatorId": "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I", + "isEnabled": true, + "isDefault": true, + "definedBy": "SYSTEM", + "properties": [ + "" + ] +} diff --git a/pom.xml b/pom.xml index 1a4c4bd54d..8707417efb 100755 --- a/pom.xml +++ b/pom.xml @@ -2468,7 +2468,7 @@ 2.0.17 - 1.3.7 + 1.3.9 1.3.46 5.5.9