diff options
author | Thomas <> | 2022-01-08 19:50:42 +0100 |
---|---|---|
committer | Thomas <> | 2022-01-08 19:50:42 +0100 |
commit | 5bdcf4b0298da05efb06eb84acdb188e4313df75 (patch) | |
tree | a1c40aef7914f58950d3ecc06e0811131430ddd3 /eaaf_modules/eaaf_module_pvp2_core/src/test | |
parent | d7f9aa156ad76e5ddaf797a16f1155c37594bd91 (diff) | |
parent | f59462296cf6eb0401be025a64b1be9ec8afc541 (diff) | |
download | EAAF-Components-5bdcf4b0298da05efb06eb84acdb188e4313df75.tar.gz EAAF-Components-5bdcf4b0298da05efb06eb84acdb188e4313df75.tar.bz2 EAAF-Components-5bdcf4b0298da05efb06eb84acdb188e4313df75.zip |
Merge branch 'opensaml_4.x' into nightlyBuild
# Conflicts:
# eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/PvpMetadataResolverAdapter.java
# eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/verification/SamlVerificationEngine.java
# eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/SoapBindingTest.java
# eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/dummy/DummyMetadataProvider.java
# eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java
# eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java
# pom.xml
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_core/src/test')
8 files changed, 65 insertions, 62 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/AbstractSamlVerificationEngine.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/AbstractSamlVerificationEngine.java index e593c1d4..abbfb1ea 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/AbstractSamlVerificationEngine.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/AbstractSamlVerificationEngine.java @@ -1,10 +1,10 @@ package at.gv.egiz.eaaf.modules.pvp2.test; +import java.time.Instant; import java.util.ArrayList; import java.util.List; import org.apache.xml.security.algorithms.JCEMapper; -import org.joda.time.DateTime; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -264,7 +264,7 @@ public abstract class AbstractSamlVerificationEngine { final Response authnReq = (Response) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), AbstractSamlVerificationEngine.class.getResourceAsStream(authnReqPath)); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); final Issuer issuer = Saml2Utils.createSamlObject(Issuer.class); issuer.setValue(spEntityId); authnReq.setIssuer(issuer); @@ -285,7 +285,7 @@ public abstract class AbstractSamlVerificationEngine { final AuthnRequest authnReq = (AuthnRequest) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), AbstractSamlVerificationEngine.class.getResourceAsStream(authnReqPath)); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); final Issuer issuer = Saml2Utils.createSamlObject(Issuer.class); issuer.setValue(spEntityId); authnReq.setIssuer(issuer); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineEidasTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineEidasTest.java index 4785879e..4577b94b 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineEidasTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineEidasTest.java @@ -1,7 +1,8 @@ package at.gv.egiz.eaaf.modules.pvp2.test; +import java.time.Instant; + import org.apache.xml.security.algorithms.JCEMapper; -import org.joda.time.DateTime; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -102,7 +103,7 @@ public class SamlVerificationEngineEidasTest { final Response response = (Response) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), AbstractSamlVerificationEngine.class.getResourceAsStream(authnReqPath)); - response.setIssueInstant(DateTime.now()); + response.setIssueInstant(Instant.now()); final Issuer issuer = Saml2Utils.createSamlObject(Issuer.class); issuer.setValue(spEntityId); response.setIssuer(issuer); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineTest.java index 57c4b93a..1f010d06 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/SamlVerificationEngineTest.java @@ -1,6 +1,8 @@ package at.gv.egiz.eaaf.modules.pvp2.test; -import org.joda.time.DateTime; +import java.time.Duration; +import java.time.Instant; + import org.junit.Test; import org.junit.runner.RunWith; import org.opensaml.core.xml.io.UnmarshallingException; @@ -219,7 +221,7 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.setIssueInstant(DateTime.now().plusMinutes(10)); + response.setIssueInstant(Instant.now().plus(Duration.ofMinutes(10))); try { verifyEngine.validateAssertion(response, credentialProvider.getMetaDataSigningCredential(), @@ -293,8 +295,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now()); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().plusMinutes(15)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now()); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().plus(Duration.ofMinutes(15))); response.getAssertions().get(0).getConditions().getAudienceRestrictions().clear(); try { @@ -320,8 +322,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now().plusMinutes(10)); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().plusMinutes(15)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now().plus(Duration.ofMinutes(10))); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().plus(Duration.ofMinutes(15))); try { verifyEngine.validateAssertion(response, credentialProvider.getMetaDataSigningCredential(), @@ -346,8 +348,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now()); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().minusMinutes(5)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now()); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().minus(Duration.ofMinutes(5))); try { verifyEngine.validateAssertion(response, credentialProvider.getMetaDataSigningCredential(), @@ -372,8 +374,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now()); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().plusMinutes(5)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now()); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().plus(Duration.ofMinutes(5))); verifyEngine.validateAssertion(response, credentialProvider.getMetaDataSigningCredential(), @@ -414,8 +416,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now()); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().plusMinutes(5)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now()); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().plus(Duration.ofMinutes(5))); final Element secAssertionElement = XMLObjectSupport.marshall(response.getAssertions().get(0)); @@ -447,8 +449,8 @@ public class SamlVerificationEngineTest extends AbstractSamlVerificationEngine { credentialProvider.getMetaDataSigningCredential()); final Response response = inputMsg.getFirst(); - response.getAssertions().get(0).getConditions().setNotBefore(DateTime.now()); - response.getAssertions().get(0).getConditions().setNotOnOrAfter(DateTime.now().plusMinutes(5)); + response.getAssertions().get(0).getConditions().setNotBefore(Instant.now()); + response.getAssertions().get(0).getConditions().setNotOnOrAfter(Instant.now().plus(Duration.ofMinutes(5))); final Element secAssertionElement = XMLObjectSupport.marshall(response.getAssertions().get(0)); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/PostBindingTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/PostBindingTest.java index 7d700b43..e7c59459 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/PostBindingTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/PostBindingTest.java @@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.time.Instant; import java.util.Base64; import java.util.Map; @@ -11,7 +12,6 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; -import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -364,7 +364,7 @@ public class PostBindingTest { final RequestAbstractType authnReq = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/eIDAS_connector_authn.xml")); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); final Issuer issuer = Saml2Utils.createSamlObject(Issuer.class); issuer.setValue("https://demo.egiz.gv.at/demoportal_demologin/"); authnReq.setIssuer(issuer); @@ -736,7 +736,7 @@ public class PostBindingTest { final RequestAbstractType authnReq = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/AuthRequest_without_sig_1.xml")); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); bindingImpl.encodeRequest(intHttpReq, intHttpResp, authnReq, "http://testservice.org", null, credentials, pendingReq); @@ -758,7 +758,7 @@ public class PostBindingTest { final StatusResponseType response = (StatusResponseType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/Response_without_sig_1.xml")); - response.setIssueInstant(DateTime.now()); + response.setIssueInstant(Instant.now()); bindingImpl.encodeResponse(intHttpReq, intHttpResp, response, "http://testservice.org", null, credentials, pendingReq); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/RedirectBindingTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/RedirectBindingTest.java index cbeca4c3..bfa4a072 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/RedirectBindingTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/RedirectBindingTest.java @@ -2,31 +2,12 @@ package at.gv.egiz.eaaf.modules.pvp2.test.binding; import java.io.IOException; import java.net.URLDecoder; +import java.time.Instant; import javax.xml.parsers.ParserConfigurationException; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.impl.http.IHttpClientFactory; -import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; -import at.gv.egiz.eaaf.modules.pvp2.PvpConstants; -import at.gv.egiz.eaaf.modules.pvp2.api.credential.EaafX509Credential; -import at.gv.egiz.eaaf.modules.pvp2.api.message.InboundMessageInterface; -import at.gv.egiz.eaaf.modules.pvp2.api.metadata.IPvp2MetadataProvider; -import at.gv.egiz.eaaf.modules.pvp2.exception.CredentialsNotAvailableException; -import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2Exception; -import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2MetadataException; -import at.gv.egiz.eaaf.modules.pvp2.exception.SamlMessageValidationException; -import at.gv.egiz.eaaf.modules.pvp2.exception.SamlSigningException; -import at.gv.egiz.eaaf.modules.pvp2.impl.binding.RedirectBinding; -import at.gv.egiz.eaaf.modules.pvp2.impl.metadata.PvpMetadataResolverFactory; -import at.gv.egiz.eaaf.modules.pvp2.impl.opensaml.initialize.EaafOpenSaml3xInitializer; -import at.gv.egiz.eaaf.modules.pvp2.impl.validation.EaafUriCompare; -import at.gv.egiz.eaaf.modules.pvp2.test.dummy.DummyCredentialProvider; -import at.gv.egiz.eaaf.modules.pvp2.test.metadata.MetadataResolverTest; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; -import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -48,6 +29,24 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.xml.sax.SAXException; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.impl.http.IHttpClientFactory; +import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; +import at.gv.egiz.eaaf.modules.pvp2.PvpConstants; +import at.gv.egiz.eaaf.modules.pvp2.api.credential.EaafX509Credential; +import at.gv.egiz.eaaf.modules.pvp2.api.message.InboundMessageInterface; +import at.gv.egiz.eaaf.modules.pvp2.api.metadata.IPvp2MetadataProvider; +import at.gv.egiz.eaaf.modules.pvp2.exception.CredentialsNotAvailableException; +import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2Exception; +import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2MetadataException; +import at.gv.egiz.eaaf.modules.pvp2.exception.SamlMessageValidationException; +import at.gv.egiz.eaaf.modules.pvp2.exception.SamlSigningException; +import at.gv.egiz.eaaf.modules.pvp2.impl.binding.RedirectBinding; +import at.gv.egiz.eaaf.modules.pvp2.impl.metadata.PvpMetadataResolverFactory; +import at.gv.egiz.eaaf.modules.pvp2.impl.opensaml.initialize.EaafOpenSaml3xInitializer; +import at.gv.egiz.eaaf.modules.pvp2.impl.validation.EaafUriCompare; +import at.gv.egiz.eaaf.modules.pvp2.test.dummy.DummyCredentialProvider; +import at.gv.egiz.eaaf.modules.pvp2.test.metadata.MetadataResolverTest; import net.shibboleth.utilities.java.support.net.URIComparator; import net.shibboleth.utilities.java.support.net.URISupport; import net.shibboleth.utilities.java.support.xml.XMLParserException; @@ -818,7 +817,7 @@ public class RedirectBindingTest { final RequestAbstractType authnReq = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), RedirectBindingTest.class.getResourceAsStream("/data/AuthRequest_without_sig_1.xml")); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); bindingImpl.encodeRequest(intHttpReq, intHttpResp, authnReq, "http://testservice.org", null, credential, pendingReq); @@ -839,7 +838,7 @@ public class RedirectBindingTest { final StatusResponseType authnReq = (StatusResponseType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), RedirectBindingTest.class.getResourceAsStream("/data/Response_without_sig_1.xml")); - authnReq.setIssueInstant(DateTime.now()); + authnReq.setIssueInstant(Instant.now()); bindingImpl.encodeResponse(intHttpReq, intHttpResp, authnReq, "http://testservice.org", null, credential, pendingReq); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/SoapBindingTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/SoapBindingTest.java index 5393179d..97a896f5 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/SoapBindingTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/binding/SoapBindingTest.java @@ -2,8 +2,8 @@ package at.gv.egiz.eaaf.modules.pvp2.test.binding; import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; +import java.time.Instant; -import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -92,7 +92,7 @@ public class SoapBindingTest { final RequestAbstractType payload = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/AuthRequest_without_sig_1.xml")); - payload.setIssueInstant(DateTime.now()); + payload.setIssueInstant(Instant.now()); final Envelope enveloped = Saml2Utils.buildSoap11Envelope(payload); final Marshaller marshaller = Constraint.isNotNull( XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(enveloped), @@ -126,7 +126,7 @@ public class SoapBindingTest { final RequestAbstractType payload = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/AuthRequest_with_sig_1.xml")); - payload.setIssueInstant(DateTime.now()); + payload.setIssueInstant(Instant.now()); final Envelope enveloped = Saml2Utils.buildSoap11Envelope(payload); final Marshaller marshaller = Constraint.isNotNull( XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(enveloped), @@ -161,7 +161,7 @@ public class SoapBindingTest { final RequestAbstractType payload = (RequestAbstractType) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), PostBindingTest.class.getResourceAsStream("/data/AuthRequest_with_sig_1.xml")); - payload.setIssueInstant(DateTime.now()); + payload.setIssueInstant(Instant.now()); final RequestAbstractType signedPayload = Saml2Utils.signSamlObject( payload, credentialProvider.getMetaDataSigningCredential(), true); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/dummy/DummyMetadataProvider.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/dummy/DummyMetadataProvider.java index 7ac1d4c5..91da692c 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/dummy/DummyMetadataProvider.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/dummy/DummyMetadataProvider.java @@ -5,17 +5,17 @@ import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.List; +import org.opensaml.saml.metadata.resolver.MetadataResolver; +import org.opensaml.saml.metadata.resolver.filter.MetadataFilter; +import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain; +import org.springframework.beans.factory.annotation.Autowired; + import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; import at.gv.egiz.eaaf.core.impl.http.IHttpClientFactory; import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2MetadataException; import at.gv.egiz.eaaf.modules.pvp2.impl.metadata.AbstractChainingMetadataProvider; import at.gv.egiz.eaaf.modules.pvp2.impl.metadata.PvpMetadataResolverFactory; -import org.opensaml.saml.metadata.resolver.MetadataResolver; -import org.opensaml.saml.metadata.resolver.filter.MetadataFilter; -import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain; -import org.springframework.beans.factory.annotation.Autowired; - public class DummyMetadataProvider extends AbstractChainingMetadataProvider { private final List<String> configuredMetadataUrls = new ArrayList<>(); diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/metadata/MetadataResolverTest.java b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/metadata/MetadataResolverTest.java index 72d6ebb8..8af53e23 100644 --- a/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/metadata/MetadataResolverTest.java +++ b/eaaf_modules/eaaf_module_pvp2_core/src/test/java/at/gv/egiz/eaaf/modules/pvp2/test/metadata/MetadataResolverTest.java @@ -8,6 +8,8 @@ import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import java.time.Duration; +import java.time.Instant; import java.util.ArrayList; import java.util.List; @@ -15,7 +17,6 @@ import javax.xml.transform.TransformerException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; -import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -295,7 +296,7 @@ public class MetadataResolverTest { final EntityDescriptor metadata = (EntityDescriptor) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), MetadataResolverTest.class.getResourceAsStream("/data/pvp_metadata_moaid_test.xml")); - metadata.setValidUntil(DateTime.now().plusDays(1)); + metadata.setValidUntil(Instant.now().plus(Duration.ofDays(1))); metadata.setSignature(null); metadata.setEntityID(RandomStringUtils.randomAlphabetic(10)); final EntityDescriptor signedMatadata = @@ -344,7 +345,7 @@ public class MetadataResolverTest { final EntityDescriptor metadata = (EntityDescriptor) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), MetadataResolverTest.class.getResourceAsStream("/data/pvp_metadata_valid_with_entityCategory.xml")); - metadata.setValidUntil(DateTime.now().plusDays(1)); + metadata.setValidUntil(Instant.now().plus(Duration.ofDays(1))); metadata.setSignature(null); metadata.setEntityID(RandomStringUtils.randomAlphabetic(10)); final EntityDescriptor signedMatadata = @@ -382,7 +383,7 @@ public class MetadataResolverTest { Assert.assertNotNull("No EntityDescripter", descr); final List<RequestedAttribute> reqAttr = descr.getSPSSODescriptor(SAMLConstants.SAML20P_NS) - .getAttributeConsumingServices().get(0).getRequestAttributes(); + .getAttributeConsumingServices().get(0).getRequestedAttributes(); Assert.assertNotNull("Req. attributes are null", reqAttr); Assert.assertEquals("# of req. attributes", 20, reqAttr.size()); @@ -398,7 +399,7 @@ public class MetadataResolverTest { XMLObjectProviderRegistrySupport.getParserPool(), MetadataResolverTest.class.getResourceAsStream( "/data/pvp_metadata_valid_with_entityCategory_egov.xml")); - metadata.setValidUntil(DateTime.now().plusDays(1)); + metadata.setValidUntil(Instant.now().plus(Duration.ofDays(1))); metadata.setSignature(null); metadata.setEntityID(RandomStringUtils.randomAlphabetic(10)); final EntityDescriptor signedMatadata = @@ -436,7 +437,7 @@ public class MetadataResolverTest { Assert.assertNotNull("No EntityDescripter", descr); final List<RequestedAttribute> reqAttr = descr.getSPSSODescriptor(SAMLConstants.SAML20P_NS) - .getAttributeConsumingServices().get(0).getRequestAttributes(); + .getAttributeConsumingServices().get(0).getRequestedAttributes(); Assert.assertNotNull("Req. attributes are null", reqAttr); Assert.assertEquals("# of req. attributes", 9, reqAttr.size()); @@ -451,7 +452,7 @@ public class MetadataResolverTest { final EntityDescriptor metadata = (EntityDescriptor) XMLObjectSupport.unmarshallFromInputStream( XMLObjectProviderRegistrySupport.getParserPool(), MetadataResolverTest.class.getResourceAsStream("/data/pvp_metadata_valid.xml")); - metadata.setValidUntil(DateTime.now().minusDays(2)); + metadata.setValidUntil(Instant.now().minus(Duration.ofDays(2))); metadata.setSignature(null); Saml2Utils.signSamlObject(metadata, credentialProvider.getMetaDataSigningCredential(), true); final Element metadataElement = XMLObjectSupport.marshall(metadata); @@ -607,7 +608,7 @@ public class MetadataResolverTest { final EntityDescriptor entityId = mdResolver.getEntityDescriptor(entityIdToResolve); Assert.assertNotNull("No EntityDescripter", entityId); - final DateTime lastRefreshSucess = mdResolver.getLastSuccessfulRefresh(); + final Instant lastRefreshSucess = mdResolver.getLastSuccessfulRefresh(); try { mdResolver.refresh(); |