Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit a8ff4bd0 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

set default folder ./smp

parent 160f1833
Branches
Tags
No related merge requests found
...@@ -54,6 +54,8 @@ RUN apt-get update \ ...@@ -54,6 +54,8 @@ RUN apt-get update \
&& echo "datasource.jndi=java:comp/env/jdbc/eDeliverySmpDs" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \ && echo "datasource.jndi=java:comp/env/jdbc/eDeliverySmpDs" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \
&& echo "\nAdd init parameters" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \ && echo "\nAdd init parameters" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \
&& echo "\nauthentication.blueCoat.enabled=true" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \ && echo "\nauthentication.blueCoat.enabled=true" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \
&& echo "\nsmp.truststore.password={DEC}{test123}" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \
&& echo "\nsmp.keystore.password={DEC}{test123}" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \
&& sed -i -e "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mysql.conf.d/mysqld.cnf \ && sed -i -e "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mysql.conf.d/mysqld.cnf \
&& mkdir /opt/jacoco \ && mkdir /opt/jacoco \
&& curl -o /opt/jacoco/jacoco-agent.jar http://central.maven.org/maven2/org/jacoco/org.jacoco.agent/$JACOCO_VERSION/org.jacoco.agent-$JACOCO_VERSION-runtime.jar && curl -o /opt/jacoco/jacoco-agent.jar http://central.maven.org/maven2/org/jacoco/org.jacoco.agent/$JACOCO_VERSION/org.jacoco.agent-$JACOCO_VERSION-runtime.jar
......
...@@ -10,9 +10,11 @@ fi ...@@ -10,9 +10,11 @@ fi
# create smp property file # create smp property file
echo "hibernate.dialect=org.hibernate.dialect.Oracle10gDialect" > "$DOMAIN_HOME/classes/smp.config.properties" echo "hibernate.dialect=org.hibernate.dialect.Oracle10gDialect" > "$DOMAIN_HOME/classes/smp.config.properties"
echo "datasource.jndi=jdbc/cipaeDeliveryDs" >> "$DOMAIN_HOME/classes/smp.config.properties" echo "\ndatasource.jndi=jdbc/cipaeDeliveryDs" >> "$DOMAIN_HOME/classes/smp.config.properties"
echo "authentication.blueCoat.enabled=true" >> "$DOMAIN_HOME/classes/smp.config.properties" echo "\nauthentication.blueCoat.enabled=true" >> "$DOMAIN_HOME/classes/smp.config.properties"
echo "log.folder=./logs/" >> "$DOMAIN_HOME/classes/smp.config.properties" echo "\nsmp.truststore.password={DEC}{test123}" >> "$DOMAIN_HOME/classes/smp.config.properties"
echo "\nsmp.keystore.password={DEC}{test123}" >> "$DOMAIN_HOME/classes/smp.config.properties"
echo "\nlog.folder=./logs/" >> "$DOMAIN_HOME/classes/smp.config.properties"
# create weblogic classpath to classes folder # create weblogic classpath to classes folder
echo "export CLASSPATH=\${CLASSPATH}:\${DOMAIN_HOME}/classes" >> "$DOMAIN_HOME/bin/setDomainEnv.sh" echo "export CLASSPATH=\${CLASSPATH}:\${DOMAIN_HOME}/classes" >> "$DOMAIN_HOME/bin/setDomainEnv.sh"
......
...@@ -187,7 +187,7 @@ public class PropertyInitialization { ...@@ -187,7 +187,7 @@ public class PropertyInitialization {
if (sigPath != null) { if (sigPath != null) {
settingsFolder = new File(sigPath).getParentFile(); settingsFolder = new File(sigPath).getParentFile();
} else { } else {
settingsFolder = new File(""); settingsFolder = new File(CONFIGURATION_DIR.getDefValue());
} }
return settingsFolder; return settingsFolder;
} }
...@@ -360,9 +360,16 @@ public class PropertyInitialization { ...@@ -360,9 +360,16 @@ public class PropertyInitialization {
} else { } else {
File settingsFolder = calculateSettingsPath(fileProperties); File settingsFolder = calculateSettingsPath(fileProperties);
// set absolute path // set absolute path
absolutePath = settingsFolder.getAbsolutePath(); absolutePath = settingsFolder.getAbsolutePath();
} }
File confFolder = new File(absolutePath);
if (!confFolder.exists()) {
LOG.warn("Configuration folder {} not exists. Folder will be created!", confFolder.getAbsolutePath());
confFolder.mkdirs();
}
LOG.info("Generate new keystore to folder: " + absolutePath); LOG.info("Generate new keystore to folder: " + absolutePath);
// add configuration path // add configuration path
storeDBEntry(em, CONFIGURATION_DIR, absolutePath); storeDBEntry(em, CONFIGURATION_DIR, absolutePath);
......
...@@ -43,7 +43,7 @@ public enum SMPPropertyEnum { ...@@ -43,7 +43,7 @@ public enum SMPPropertyEnum {
TRUSTSTORE_FILENAME("smp.truststore.filename","","Truststore filename ", false, false , SMPPropertyTypeEnum.FILENAME), TRUSTSTORE_FILENAME("smp.truststore.filename","","Truststore filename ", false, false , SMPPropertyTypeEnum.FILENAME),
CERTIFICATE_CRL_FORCE("smp.certificate.crl.force","false","If false then if CRL is not reachable ignore CRL validation", false, false , SMPPropertyTypeEnum.BOOLEAN), CERTIFICATE_CRL_FORCE("smp.certificate.crl.force","false","If false then if CRL is not reachable ignore CRL validation", false, false , SMPPropertyTypeEnum.BOOLEAN),
CONFIGURATION_DIR("configuration.dir","./","Path to the folder containing all the configuration files (keystore and encryption key)", true, false , SMPPropertyTypeEnum.PATH), CONFIGURATION_DIR("configuration.dir","smp","Path to the folder containing all the configuration files (keystore and encryption key)", true, false , SMPPropertyTypeEnum.PATH),
ENCRYPTION_FILENAME("encryption.key.filename","encryptionPrivateKey.private","Key filename to encrypt passwords", false, false , SMPPropertyTypeEnum.FILENAME), ENCRYPTION_FILENAME("encryption.key.filename","encryptionPrivateKey.private","Key filename to encrypt passwords", false, false , SMPPropertyTypeEnum.FILENAME),
KEYSTORE_PASSWORD_DECRYPTED("smp.keystore.password.decrypted","","Only for backup purposes when password is automatically created. Store password somewhere save and delete this entry!", false, false , SMPPropertyTypeEnum.STRING), KEYSTORE_PASSWORD_DECRYPTED("smp.keystore.password.decrypted","","Only for backup purposes when password is automatically created. Store password somewhere save and delete this entry!", false, false , SMPPropertyTypeEnum.STRING),
TRUSTSTORE_PASSWORD_DECRYPTED("smp.truststore.password.decrypted","","Only for backup purposes when password is automatically created. Store password somewhere save and delete this entry!", false, false , SMPPropertyTypeEnum.STRING), TRUSTSTORE_PASSWORD_DECRYPTED("smp.truststore.password.decrypted","","Only for backup purposes when password is automatically created. Store password somewhere save and delete this entry!", false, false , SMPPropertyTypeEnum.STRING),
......
...@@ -4,9 +4,12 @@ import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyEnum; ...@@ -4,9 +4,12 @@ import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyEnum;
import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyTypeEnum; import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyTypeEnum;
import eu.europa.ec.edelivery.smp.exceptions.ErrorCode; import eu.europa.ec.edelivery.smp.exceptions.ErrorCode;
import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException; import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
import eu.europa.ec.edelivery.smp.logging.SMPLogger;
import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.validator.routines.EmailValidator; import org.apache.commons.validator.routines.EmailValidator;
import org.apache.commons.validator.routines.UrlValidator; import org.apache.commons.validator.routines.UrlValidator;
import org.springframework.security.authentication.AuthenticationProvider;
import java.io.File; import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
...@@ -17,6 +20,8 @@ import java.util.regex.PatternSyntaxException; ...@@ -17,6 +20,8 @@ import java.util.regex.PatternSyntaxException;
public class PropertyUtils { public class PropertyUtils {
private static final SMPLogger LOG = SMPLoggerFactory.getLogger(PropertyUtils.class);
private static UrlValidator urlValidator = new UrlValidator(new String[]{"http", "https"}, UrlValidator.ALLOW_LOCAL_URLS); private static UrlValidator urlValidator = new UrlValidator(new String[]{"http", "https"}, UrlValidator.ALLOW_LOCAL_URLS);
...@@ -69,6 +74,12 @@ public class PropertyUtils { ...@@ -69,6 +74,12 @@ public class PropertyUtils {
} }
case PATH: { case PATH: {
File f = new File(value); File f = new File(value);
if (!f.exists()) {
LOG.warn("Folder {} not exists. Try to create the folder.", f.getAbsolutePath());
if (f.mkdirs()){
LOG.info("Folder {} created.", f.getAbsolutePath());
};
}
return f.exists() && f.isDirectory(); return f.exists() && f.isDirectory();
} }
// nothing to validate // nothing to validate
......
...@@ -131,7 +131,7 @@ public class PropertyInitializationTest { ...@@ -131,7 +131,7 @@ public class PropertyInitializationTest {
// when // when
File f = testInstance.calculateSettingsPath(p); File f = testInstance.calculateSettingsPath(p);
// then // then
assertEquals((new File("")).getAbsolutePath(), f.getAbsolutePath()); assertEquals((new File("smp")).getAbsolutePath(), f.getAbsolutePath());
} }
@Test @Test
......
...@@ -36,7 +36,7 @@ public class PropertyUtilsTest { ...@@ -36,7 +36,7 @@ public class PropertyUtilsTest {
{EMAIL, "test@coms.fs", false, false}, {EMAIL, "test@coms.fs", false, false},
{FILENAME, "myfilename.txt", true, true}, {FILENAME, "myfilename.txt", true, true},
{PATH, "./", true, true}, {PATH, "./", true, true},
{PATH, "./notexits-tst", false, true}, {PATH, "./notexits", true, true}, // path will be created
}; };
} }
......
...@@ -134,7 +134,7 @@ log.folder=../logs/ ...@@ -134,7 +134,7 @@ log.folder=../logs/
# smp.certificate.crl.force=false # smp.certificate.crl.force=false
# Path to the folder containing all the configuration files (keystore and encryption key) # Path to the folder containing all the configuration files (keystore and encryption key)
# configuration.dir=./ # configuration.dir=./smp/
# Key filename to encrypt passwords # Key filename to encrypt passwords
# encryption.key.filename=encryptionPrivateKey.private # encryption.key.filename=encryptionPrivateKey.private
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment