diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-01-09 18:56:32 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-01-09 18:56:32 +0100 |
commit | 1bcc269ff8f16b2a4dee4f393e4259f4768ca3a0 (patch) | |
tree | 287476f07b0a4af5d660b623c1ca21c7868946dc | |
parent | 8d8221ab72222bae0fe50bfd1e8b4266eec40e11 (diff) | |
download | National_eIDAS_Gateway-1bcc269ff8f16b2a4dee4f393e4259f4768ca3a0.tar.gz National_eIDAS_Gateway-1bcc269ff8f16b2a4dee4f393e4259f4768ca3a0.tar.bz2 National_eIDAS_Gateway-1bcc269ff8f16b2a4dee4f393e4259f4768ca3a0.zip |
extend SpringBoot application-initializer to support deployment in Apache Tomcat application-services
-rw-r--r-- | basicConfig/default_config.properties | 2 | ||||
-rw-r--r-- | connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java | 39 |
2 files changed, 35 insertions, 6 deletions
diff --git a/basicConfig/default_config.properties b/basicConfig/default_config.properties index bb0829b8..8a1bc3a0 100644 --- a/basicConfig/default_config.properties +++ b/basicConfig/default_config.properties @@ -36,7 +36,6 @@ eidas.ms.auth.eIDAS.szrclient.ssl.trustStore.password= eidas.ms.auth.eIDAS.authblock.keystore.type=jks eidas.ms.auth.eIDAS.authblock.keystore.path=keys/teststore.jks eidas.ms.auth.eIDAS.authblock.keystore.password=f/+saJBc3a}*/T^s -eidas.ms.auth.eIDAS.authblock.keystore.name= eidas.ms.auth.eIDAS.authblock.key.alias=connectorkeypair eidas.ms.auth.eIDAS.authblock.key.password=f/+saJBc3a}*/T^s @@ -63,4 +62,5 @@ eidas.ms.pvp2.metadata.contact.email=max@junit.test eidas.ms.sp.0.uniqueID= eidas.ms.sp.0.pvp2.metadata.truststore= eidas.ms.sp.0.pvp2.metadata.truststore.password= +eidas.ms.sp.0.newEidMode=false diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java index 1e84cbb0..428f5f56 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java @@ -1,22 +1,26 @@ package at.asitplus.eidas.specific.connector; +import org.opensaml.core.config.InitializationException; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.web.context.WebApplicationContext; import at.gv.egiz.eaaf.core.api.IStatusMessenger; import at.gv.egiz.eaaf.core.impl.logging.LogMessageProviderFactory; import at.gv.egiz.eaaf.core.impl.logging.SimpleStatusMessager; -import at.gv.egiz.eaaf.core.impl.utils.Random; import at.gv.egiz.eaaf.modules.pvp2.impl.opensaml.initialize.EaafOpenSaml3xInitializer; import lombok.extern.slf4j.Slf4j; +import net.shibboleth.utilities.java.support.component.ComponentInitializationException; @Slf4j @SpringBootApplication(scanBasePackages = { "at.asitplus.eidas.specific.connector", "at.gv.egiz.eaaf.utils.springboot.ajp" }) -public class SpringBootApplicationInitializer { +public class SpringBootApplicationInitializer extends SpringBootServletInitializer { private static ConfigurableApplicationContext ctx; @@ -42,9 +46,6 @@ public class SpringBootApplicationInitializer { // initialize status messenger LogMessageProviderFactory.setStatusMessager(ctx.getBean(IStatusMessenger.class)); - - log.info("Seed random number generator ... "); - Random.seedRandom(); log.info("Initialization of MS-specific eIDAS-Implementation finished."); @@ -56,6 +57,34 @@ public class SpringBootApplicationInitializer { } + + protected SpringApplicationBuilder createSpringApplicationBuilder() { + try { + log.info("Bootstrap openSAML .... "); + EaafOpenSaml3xInitializer.eaafInitialize(); + + } catch (InitializationException | ComponentInitializationException e) { + throw new RuntimeException(e); + + } + + SpringApplicationBuilder builder = new SpringApplicationBuilder(); + builder.initializers(new MsSpecificSpringBootApplicationContextInitializer()); + return builder; + + } + + protected WebApplicationContext run(SpringApplication application) { + WebApplicationContext internalContext = (WebApplicationContext) application.run(); + + // initialize status messenger + LogMessageProviderFactory.setStatusMessager(internalContext.getBean(IStatusMessenger.class)); + + log.info("Initialization of MS-specific eIDAS-Implementation finished."); + + return internalContext; + } + /** * Stops SpringBoot application of MS-specific eIDAS-Implementation. * |