aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-05-15 10:20:59 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-05-15 10:20:59 +0200
commitd0f2b9de4406d73ea4e3beecc3ddc551fd1f73fb (patch)
tree72178e49918f2f1c40106e5976e60149a2cf0c12 /id/ConfigWebTool/src/main/java/at/gv
parentaae0d003526cb8665df93bb715ba126dd12a473d (diff)
downloadmoa-id-spss-d0f2b9de4406d73ea4e3beecc3ddc551fd1f73fb.tar.gz
moa-id-spss-d0f2b9de4406d73ea4e3beecc3ddc551fd1f73fb.tar.bz2
moa-id-spss-d0f2b9de4406d73ea4e3beecc3ddc551fd1f73fb.zip
check if SAML2 metadata is loadable and valid
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
index c9488706a..345d25cda 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
@@ -35,9 +35,14 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.httpclient.MOAHttpClient;
import org.apache.log4j.Logger;
+import org.opensaml.Configuration;
import org.opensaml.saml2.metadata.provider.HTTPMetadataProvider;
import org.opensaml.saml2.metadata.provider.MetadataFilter;
import org.opensaml.saml2.metadata.provider.MetadataProviderException;
+import org.opensaml.xml.io.Marshaller;
+import org.opensaml.xml.io.MarshallerFactory;
+import org.opensaml.xml.io.Unmarshaller;
+import org.opensaml.xml.io.UnmarshallerFactory;
import org.opensaml.xml.parse.BasicParserPool;
import org.opensaml.xml.security.x509.BasicX509Credential;
@@ -126,10 +131,18 @@ public class OAPVP2ConfigValidation {
httpProvider =
new HTTPMetadataProvider(timer, httpClient, form.getMetaDataURL());
httpProvider.setParserPool(new BasicParserPool());
- httpProvider.setRequireValidMetadata(true);
- MetadataFilter filter = new MetaDataVerificationFilter(credential);
- httpProvider.setMetadataFilter(filter);
+ httpProvider.setRequireValidMetadata(true);
+ httpProvider.setMetadataFilter(new MetaDataVerificationFilter(credential));
+ httpProvider.setMinRefreshDelay(1000*60*15); //15 minutes
+ httpProvider.setMaxRefreshDelay(1000*60*60*24); //24 hours
httpProvider.initialize();
+
+ if (httpProvider.getMetadata() == null) {
+ log.info("Metadata could be received but validation FAILED.");
+ errors.add(LanguageHelper.getErrorString("validation.pvp2.metadata.validation", request));
+ }
+
+
}
}
}