diff --git a/smp-angular/src/app/edit/edit-group/edit-group.component.html b/smp-angular/src/app/edit/edit-group/edit-group.component.html index 7437b134c52e1cce7fe8605f423ae59a544c83f7..86363c03a06a627ff4ea3a7b2899f885542fa2f0 100644 --- a/smp-angular/src/app/edit/edit-group/edit-group.component.html +++ b/smp-angular/src/app/edit/edit-group/edit-group.component.html @@ -32,7 +32,7 @@ <mat-select placeholder="Select domain" matTooltip="Select domain." id="domain_id" - [value]="selectedDomain" + [(value)]="selectedDomain" required> <mat-option *ngFor="let domain of domainList" [value]="domain" diff --git a/smp-examples/pom.xml b/smp-examples/pom.xml index 79e3dc2c89503d24f70a299fb067c9a320fb52c8..d2736ea0ba1918fb777bd44f752db175765dae3f 100644 --- a/smp-examples/pom.xml +++ b/smp-examples/pom.xml @@ -25,6 +25,6 @@ <packaging>pom</packaging> <description>The sub-project contains SMP examples of API and SPI implementations. Currently, SPI payload validation example.</description> <modules> - <module>smp-spi-example</module> + <module>smp-spi-payload-validation-example</module> </modules> </project> diff --git a/smp-examples/smp-spi-example/pom.xml b/smp-examples/smp-spi-payload-validation-example/pom.xml similarity index 96% rename from smp-examples/smp-spi-example/pom.xml rename to smp-examples/smp-spi-payload-validation-example/pom.xml index e079f8748e97d140f5e2434333c17a1960f9f001..c574fe76eb5a44b82f0fefa90e4621a1c8eb84f5 100644 --- a/smp-examples/smp-spi-example/pom.xml +++ b/smp-examples/smp-spi-payload-validation-example/pom.xml @@ -24,7 +24,7 @@ <maven.deploy.skip>false</maven.deploy.skip> </properties> - <artifactId>smp-spi-example</artifactId> + <artifactId>smp-spi-payload-validation-example</artifactId> <name>smp-spi-example</name> <description>Example of SMP's SPI Payload validation.</description> <dependencies> diff --git a/smp-examples/smp-spi-example/src/main/java/eu/europa/ec/smp/spi/ExamplePayloadValidatorSpiImpl.java b/smp-examples/smp-spi-payload-validation-example/src/main/java/eu/europa/ec/smp/spi/ExamplePayloadValidatorSpiImpl.java similarity index 100% rename from smp-examples/smp-spi-example/src/main/java/eu/europa/ec/smp/spi/ExamplePayloadValidatorSpiImpl.java rename to smp-examples/smp-spi-payload-validation-example/src/main/java/eu/europa/ec/smp/spi/ExamplePayloadValidatorSpiImpl.java diff --git a/smp-examples/smp-spi-example/src/main/resources/logback.xml b/smp-examples/smp-spi-payload-validation-example/src/main/resources/logback.xml similarity index 100% rename from smp-examples/smp-spi-example/src/main/resources/logback.xml rename to smp-examples/smp-spi-payload-validation-example/src/main/resources/logback.xml diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/doc/DBResource.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/doc/DBResource.java index 8e7dc163ca574b3175bd3142253921f38f41509b..2b97648c7249be4cae598620e13a1c7f36c78d3d 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/doc/DBResource.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/doc/DBResource.java @@ -76,40 +76,40 @@ import static eu.europa.ec.edelivery.smp.data.dao.QueryNames.*; @NamedQuery(name = "DBResource.getPublicSearch", query = "SELECT r FROM DBResource r WHERE r.group.visibility='PUBLIC' " + " AND (r.group.domain.visibility='PUBLIC' " + " OR :user_id IS NOT NULL " + - " AND ( (select count(id) from DBDomainMember dm where dm.user.id = :user_id and dm.domain.id = r.group.domain.id) > 0 " + - " OR (select count(id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.domain.id = r.group.domain.id) > 0 " + - " OR (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.domain.id = r.group.domain.id) > 0 " + + " AND ( (select count(dm.id) from DBDomainMember dm where dm.user.id = :user_id and dm.domain.id = r.group.domain.id) > 0 " + + " OR (select count(gm.id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.domain.id = r.group.domain.id) > 0 " + + " OR (select count(rm.id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.domain.id = r.group.domain.id) > 0 " + " ) " + " ) " + " AND (r.group.visibility='PUBLIC' " + - " OR :user_id IS NOT NULL " + - " AND ( (select count(id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.id = r.group.id) > 0 " + - " OR (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.id = r.group.id) > 0 " + - " ) " + + " OR (:user_id IS NOT NULL " + + " AND ( (select count(gm.id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.id = r.group.id) > 0 " + + " OR (select count(rm.id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.id = r.group.id) > 0 " + + " ) )" + " ) " + " AND ( r.visibility = 'PUBLIC' " + - " OR :user_id IS NOT NULL " + - " AND (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.id = r.id) > 0 ) " + + " OR (:user_id IS NOT NULL " + + " AND (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.id = r.id) > 0 )) " + " AND (:resource_identifier IS NULL OR r.identifierValue like :resource_identifier )" + " AND (:resource_scheme IS NULL OR r.identifierScheme like :resource_scheme) order by r.identifierScheme, r.identifierValue" ) @NamedQuery(name = "DBResource.getPublicSearchCount", query = "SELECT count(r.id) FROM DBResource r WHERE r.group.visibility='PUBLIC' " + " AND (r.group.domain.visibility='PUBLIC' " + " OR :user_id IS NOT NULL " + - " AND ( (select count(id) from DBDomainMember dm where dm.user.id = :user_id and dm.domain.id = r.group.domain.id) > 0 " + - " OR (select count(id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.domain.id = r.group.domain.id) > 0 " + - " OR (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.domain.id = r.group.domain.id) > 0 " + + " AND ( (select count(dm.id) from DBDomainMember dm where dm.user.id = :user_id and dm.domain.id = r.group.domain.id) > 0 " + + " OR (select count(gm.id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.domain.id = r.group.domain.id) > 0 " + + " OR (select count(rm.id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.domain.id = r.group.domain.id) > 0 " + " ) " + " ) " + " AND (r.group.visibility='PUBLIC' " + " OR :user_id IS NOT NULL " + - " AND ( (select count(id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.id = r.group.id) > 0 " + - " OR (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.id = r.group.id) > 0 " + + " AND ( (select count(gm.id) from DBGroupMember gm where gm.user.id = :user_id and gm.group.id = r.group.id) > 0 " + + " OR (select count(rm.id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.group.id = r.group.id) > 0 " + " ) " + " ) " + " AND ( r.visibility = 'PUBLIC' " + " OR :user_id IS NOT NULL " + - " AND (select count(id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.id = r.id) > 0 ) " + + " AND (select count(rm.id) from DBResourceMember rm where rm.user.id = :user_id and rm.resource.id = r.id) > 0 ) " + " AND (:resource_identifier IS NULL OR r.identifierValue like :resource_identifier )" + " AND (:resource_scheme IS NULL OR r.identifierScheme like :resource_scheme)" ) diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java index 758b51974c7fece93812080e821d3e32e5820a3e..ac2e40e771c44f9aff370cf8a3caa4a5a3538514 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/SMLIntegrationService.java @@ -94,8 +94,7 @@ public class SMLIntegrationService { LOG.businessDebug(BUS_SML_REGISTER_SERVICE_GROUP, resource.getIdentifierValue(), resource.getIdentifierScheme(), domain.getDomainCode()); if (!isSMLIntegrationEnabled()) { String msg = "SML integration is not enabled!"; - LOG.businessError(BUS_SML_REGISTER_SERVICE_GROUP_FAILED, resource.getIdentifierValue(), resource.getIdentifierScheme(), domain.getDomainCode(), msg); - throw new SMPRuntimeException(CONFIGURATION_ERROR, msg); + LOG.businessWarn(BUS_SML_REGISTER_SERVICE_GROUP_FAILED, resource.getIdentifierValue(), resource.getIdentifierScheme(), domain.getDomainCode(), msg); } Identifier normalizedParticipantId = identifierService .normalizeParticipant(resource.getIdentifierScheme(), resource.getIdentifierValue()); diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreServiceTest.java index d60081d56d2ec5d17c6eefaf056ea4b9111d19a1..11c7672d81dd8c86051a21978a0cf23d55bed4ca 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreServiceTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreServiceTest.java @@ -1,5 +1,7 @@ package eu.europa.ec.edelivery.smp.services.ui; +import eu.europa.ec.edelivery.security.utils.KeystoreUtils; +import eu.europa.ec.edelivery.security.utils.X509CertificateUtils; import eu.europa.ec.edelivery.smp.data.dao.UserDao; import eu.europa.ec.edelivery.smp.data.model.user.DBUser; import eu.europa.ec.edelivery.smp.data.ui.CertificateRO; @@ -8,6 +10,7 @@ import eu.europa.ec.edelivery.smp.services.CRLVerifierService; import eu.europa.ec.edelivery.smp.services.ConfigurationService; import eu.europa.ec.edelivery.smp.testutil.X509CertificateTestUtils; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; @@ -16,11 +19,15 @@ import org.springframework.core.convert.ConversionService; import javax.security.auth.x500.X500Principal; import java.io.File; +import java.io.FileOutputStream; +import java.math.BigInteger; import java.nio.file.Path; import java.nio.file.Paths; import java.security.KeyStore; import java.security.Security; import java.security.cert.*; +import java.util.Arrays; +import java.util.List; import java.util.Optional; import java.util.UUID; import java.util.regex.Pattern; @@ -175,6 +182,7 @@ public class UITruststoreServiceTest { resultException.getMessage()); } + @Test public void validateCertificateSubjectExpressionLegacyValidatedMatch() throws Exception { String regularExpression = ".*CN=Something.*"; @@ -201,4 +209,29 @@ public class UITruststoreServiceTest { result = testInstance.loadTruststore(resourceDirectory.toFile()); assertNull(result); } + + + /** + * This method is not a tests is it done for generating the tests Soapui certificates + * @throws Exception + */ + @Test + @Ignore + public void generateSoapUITestCertificates() throws Exception { + + List <String[]> listCerts = Arrays.asList( new String[]{"f71ee8b11cb3b787","CN=EHEALTH_SMP_EC,O=European Commission,C=BE","ehealth_smp_ec",}, + new String[]{"E07B6b956330a19a","CN=blue_gw,O=eDelivery,C=BE","blue_gw"}, + new String[]{"9792ce69BC89F14C","CN=red_gw,O=eDelivery,C=BE","red_gw"} + ); + String token = "test123"; + File keystoreFile = new File( "./target/smp-test-examples.p12"); + KeyStore keyStore = KeystoreUtils.createNewKeystore(keystoreFile, token); + for (String[] data: listCerts) { + BigInteger serial = new BigInteger(data[0],16); + X509CertificateUtils.createAndStoreSelfSignedCertificate(serial, data[1],data[2], keyStore, token); + } + try (FileOutputStream fos = new FileOutputStream(keystoreFile)) { + keyStore.store(fos, token.toCharArray()); + } + } }