diff options
Diffstat (limited to 'connector/src/main')
-rw-r--r-- | connector/src/main/java/at/asitplus/eidas/specific/connector/SpringBootApplicationInitializer.java | 39 |
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. * |