[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java ...

noreply at shibboleth.net noreply at shibboleth.net
Wed Sep 28 21:00:39 EDT 2016


Author: putmanb
Date: Wed Sep 28 21:00:39 2016
New Revision: 4504

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4504&view=rev
Log:
More work on OSJ-130: Create metadata index impl for SAML artifacts

Refactored so criteria is based more generally on a SAMLArtifact, rather than just a sourceID.
This moves handling of various artifact types into the index impl, rather than the caller.
Added indexing support for the samlmd:SourceID extension element in a role descriptor.
Support for indexing and lookup for SAML 1 type 2 artifact source location still pending.

Added:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java
      - copied, changed from r4501, trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactSourceIDCriterion.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/SAMLArtifactMetadataIndex.java
      - copied, changed from r4501, trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/ArtifactSourceIDMetadataIndex.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/SAMLArtifactMetadataIndexTest.java
      - copied, changed from r4501, trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/ArtifactSourceIDMetadataIndexTest.java
Modified:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactSourceIDCriterion.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/ArtifactSourceIDMetadataIndex.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPArtifactDecoder.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/ArtifactSourceIDMetadataIndexTest.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexingTest.java

Copied: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java (from r4501, trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactSourceIDCriterion.java)
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java?p2=trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java&p1=trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactSourceIDCriterion.java&r1=4501&r2=4504&rev=4504&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactSourceIDCriterion.java	(original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/criterion/ArtifactCriterion.java	Wed Sep 28 21:00:39 2016
@@ -17,46 +17,46 @@
 
 package org.opensaml.saml.criterion;
 
-import java.util.Arrays;
+import java.util.Objects;
 
 import javax.annotation.Nonnull;
 
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.codec.Base64Support;
+import org.apache.commons.codec.binary.Hex;
+import org.opensaml.saml.common.binding.artifact.SAMLArtifact;
+
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.resolver.Criterion;
 
-/** {@link Criterion} representing a SAML artifact SourceID. */
-public final class ArtifactSourceIDCriterion implements Criterion {
+/** {@link Criterion} representing a {@link SAMLArtifact}. */
+public final class ArtifactCriterion implements Criterion {
 
     /** The SourceID value. */
-    @Nonnull @NotEmpty private final byte[] sourceID;
+    @Nonnull private final SAMLArtifact artifact;
 
     /**
      * Constructor.
      * 
-     * @param newSourceID the artifact SourceID value
+     * @param newArtifact the artifact value
      */
-    public ArtifactSourceIDCriterion(@Nonnull @NotEmpty final byte[] newSourceID) {
-        sourceID = Constraint.isNotNull(newSourceID, "SourceID cannot be null");
-        Constraint.isGreaterThan(0, sourceID.length, "SourceID length must be greater than zero");
+    public ArtifactCriterion(@Nonnull final SAMLArtifact newArtifact) {
+        artifact = Constraint.isNotNull(newArtifact, "SAMLArtifact cannot be null");
     }
 
     /**
-     * Get the SourceID value.
+     * Get the SAML artifact.
      * 
-     * @return the SourceID value
+     * @return the SAML artifact
      */
-    @Nonnull @NotEmpty public byte[] getSourceID() {
-        return sourceID;
+    @Nonnull public SAMLArtifact getArtifact() {
+        return artifact;
     }
 
     /** {@inheritDoc} */
     @Override
     public String toString() {
         StringBuilder builder = new StringBuilder();
-        builder.append("ArtifactSourceIDCriterion [value=");
-        builder.append(Base64Support.encode(sourceID, false));
+        builder.append("ArtifactCriterion [artifact=");
+        builder.append(Hex.encodeHex(artifact.getArtifactBytes(), true));
         builder.append("]");

[... 692 lines stripped ...]


More information about the commits mailing list