diff options
author | Thomas <> | 2022-08-17 12:52:38 +0200 |
---|---|---|
committer | Thomas <> | 2022-08-17 12:52:38 +0200 |
commit | e42c64bf1eddbb8f7d93d48b6c8f9481369a751f (patch) | |
tree | 38ccf9df5084e1424c2344d7bb92c5be27ef2b2a /ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health | |
parent | 1f6c93f94b628e9e702f86fcaea6d34c858687fc (diff) | |
parent | d83cf36c1454a10f5a46d677b5f0f30e0cbe7e95 (diff) | |
download | National_eIDAS_Gateway-e42c64bf1eddbb8f7d93d48b6c8f9481369a751f.tar.gz National_eIDAS_Gateway-e42c64bf1eddbb8f7d93d48b6c8f9481369a751f.tar.bz2 National_eIDAS_Gateway-e42c64bf1eddbb8f7d93d48b6c8f9481369a751f.zip |
Merge branch 'nightlybuild' of gitlab.iaik.tugraz.at:egiz/eidas_at_proxy into nightlybuild
Diffstat (limited to 'ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health')
-rw-r--r-- | ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health/Saml2MetadataHealthIndicator.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health/Saml2MetadataHealthIndicator.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health/Saml2MetadataHealthIndicator.java new file mode 100644 index 00000000..592231b0 --- /dev/null +++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/connector/health/Saml2MetadataHealthIndicator.java @@ -0,0 +1,44 @@ +package at.asitplus.eidas.specific.connector.health; + +import javax.xml.transform.TransformerFactoryConfigurationError; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.HealthIndicator; + +import at.gv.egiz.eaaf.modules.pvp2.api.metadata.IPvpMetadataBuilderConfiguration; +import at.gv.egiz.eaaf.modules.pvp2.api.metadata.IPvpMetadataConfigurationFactory; +import at.gv.egiz.eaaf.modules.pvp2.impl.builder.PvpMetadataBuilder; +import at.gv.egiz.eaaf.modules.pvp2.impl.utils.AbstractCredentialProvider; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class Saml2MetadataHealthIndicator implements HealthIndicator { + + @Autowired + private PvpMetadataBuilder metadatabuilder; + @Autowired + private IPvpMetadataConfigurationFactory configFactory; + + @Setter + private AbstractCredentialProvider pvpIdpCredentials; + + @Override + public Health health() { + try { + // build metadata + final IPvpMetadataBuilderConfiguration metadataConfig = + configFactory.generateMetadataBuilderConfiguration( + "http://localhost/monitoring", + pvpIdpCredentials); + metadatabuilder.buildPvpMetadata(metadataConfig); + return Health.up().build(); + + } catch (Exception | TransformerFactoryConfigurationError e) { + return Health.down().down(e).build(); + + } + } + +} |