aboutsummaryrefslogtreecommitdiff
path: root/connector/src/main/java/at
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-09 18:56:32 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-09 18:56:32 +0100
commit1bcc269ff8f16b2a4dee4f393e4259f4768ca3a0 (patch)
tree287476f07b0a4af5d660b623c1ca21c7868946dc /connector/src/main/java/at
parent8d8221ab72222bae0fe50bfd1e8b4266eec40e11 (diff)
downloadNational_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
Diffstat (limited to 'connector/src/main/java/at')
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java39
1 files changed, 34 insertions, 5 deletions
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.
*