[java-identity-provider COMMIT] /trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySuppo...

noreply at shibboleth.net noreply at shibboleth.net
Thu Sep 12 00:23:35 EDT 2013


Author: putmanb
Date: Thu Sep 12 00:23:35 2013
New Revision: 4767

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4767&view=rev
Log:
Can't use a class here from opensaml-security-impl, don't want an IdP module depending on an OpenSAML -impl module.
Since the needed interface impl is trivial, just make a new static nested class inside the support class.

Modified:
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySupport.java

Modified: trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySupport.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySupport.java?rev=4767&r1=4766&r2=4767&view=diff
==============================================================================
--- trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySupport.java (original)
+++ trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/xmlobject/KeyAuthoritySupport.java Thu Sep 12 00:23:35 2013
@@ -22,13 +22,16 @@
 import java.security.cert.X509CRL;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.security.SecurityException;
 import org.opensaml.security.x509.PKIXValidationInformation;
-import org.opensaml.security.x509.impl.BasicPKIXValidationInformation;
 import org.opensaml.xmlsec.keyinfo.KeyInfoSupport;
 import org.opensaml.xmlsec.signature.KeyInfo;
 
@@ -80,7 +83,7 @@
             return null;
         }
 
-        return new BasicPKIXValidationInformation(certs, crls, depth);
+        return new KeyAuthorityPKIXValidationInformation(certs, crls, depth);
     }
     
     /**
@@ -114,5 +117,50 @@
         }
 
     }
+    
+    /**
+     * Basic implementation of {@link PKIXValidationInformation}.
+     */
+    public static class KeyAuthorityPKIXValidationInformation implements PKIXValidationInformation {
+
+        /** Certs used as the trust anchors. */
+        private final Collection<X509Certificate> trustAnchors;
+
+        /** CRLs used during validation. */
+        private final Collection<X509CRL> trustedCRLs;
+
+        /** Max verification depth during PKIX validation. */
+        private final Integer verificationDepth;
+
+        /**
+         * Constructor.
+         * 
+         * @param anchors certs used as trust anchors during validation
+         * @param crls CRLs used during validation
+         * @param depth max verification path depth
+         */
+        public KeyAuthorityPKIXValidationInformation(@Nullable final Collection<X509Certificate> anchors,
+                @Nullable final Collection<X509CRL> crls, @Nonnull final Integer depth) {
+
+            verificationDepth = Constraint.isNotNull(depth, "Verification depth cannot be null");
+            trustAnchors = anchors;
+            trustedCRLs = crls;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable public Collection<X509CRL> getCRLs() {
+            return trustedCRLs;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable public Collection<X509Certificate> getCertificates() {
+            return trustAnchors;
+        }
+
+        /** {@inheritDoc} */
+        @Nonnull public Integer getVerificationDepth() {
+            return verificationDepth;
+        }
+    }
 
 }



More information about the commits mailing list