[java-identity-provider] branch master updated: Adjust base class of flow descriptor.

Scott Cantor cantor.2 at osu.edu
Tue Jan 15 11:39:03 EST 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=c17b06bb7d8e38d1886419680efdfdb586228c6a

The following commit(s) were added to refs/heads/master by this push:
       new  c17b06b   Adjust base class of flow descriptor.
c17b06b is described below

commit c17b06bb7d8e38d1886419680efdfdb586228c6a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jan 15 11:39:00 2019 -0500

    Adjust base class of flow descriptor.
---
 .../NameIDCanonicalizationFlowDescriptor.java      | 38 +++++++++-------------
 .../saml/nameid/impl/LegacyCanonicalization.java   |  8 ++---
 2 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
index 5a87433..39d1021 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
@@ -18,37 +18,40 @@
 package net.shibboleth.idp.saml.nameid;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
 
 import net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor;
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.collection.CollectionSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableSet;
 
 /**
  * A class used to describe flow descriptors for {@link net.shibboleth.idp.saml.authn.principal.NameIDPrincipal} and
- * {@link net.shibboleth.idp.saml.authn.principal.NameIdentifierPrincipal}. This adds the concept of formats to the base
- * class.
+ * {@link net.shibboleth.idp.saml.authn.principal.NameIdentifierPrincipal} c14n. This adds the concept of formats to
+ * the base class.
  */
 public class NameIDCanonicalizationFlowDescriptor extends SubjectCanonicalizationFlowDescriptor {
 
     /** Store Set of acceptable formats. */
-    @NonnullAfterInit @Unmodifiable private Set<String> formats;
+    @Nonnull private Set<String> formats;
 
+    /** Constructor. */
+    public NameIDCanonicalizationFlowDescriptor() {
+        formats = Collections.emptySet();
+    }
+    
     /**
      * Return the set of acceptable formats.
      * 
      * @return Returns the formats. Never empty after initialization.
      */
-    @Nonnull public Collection<String> getFormats() {
+    @Nonnull @NonnullElements public Collection<String> getFormats() {
         return formats;
     }
 
@@ -58,21 +61,10 @@ public class NameIDCanonicalizationFlowDescriptor extends SubjectCanonicalizatio
      * @param theFormats The formats to set.
      */
     public void setFormats(@Nonnull final Collection<String> theFormats) {
-        Constraint.isNotNull(theFormats, "Format list must be non null");
-        Constraint.isNotEmpty(theFormats, "Format list must be non empty");
-        final Set<String> newFormats = new HashSet(theFormats.size());
-        CollectionSupport.addIf(newFormats, theFormats, Predicates.notNull());
-
-        formats = ImmutableSet.copyOf(newFormats);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void doInitialize() throws ComponentInitializationException {
-        super.doInitialize();
-        if (null == formats || formats.isEmpty()) {
-            throw new ComponentInitializationException("NameIDFlow Descriptor " + getId()
-                    + " Should specify one or more formats");
-        }
+        Constraint.isNotNull(theFormats, "Format collection cannot be null");
+        
+        formats = new HashSet(theFormats.size());
+        CollectionSupport.addIf(formats, theFormats, Predicates.notNull());
     }
     
 }
\ No newline at end of file
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/LegacyCanonicalization.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/LegacyCanonicalization.java
index d4fe8c3..568e7c2 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/LegacyCanonicalization.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/LegacyCanonicalization.java
@@ -36,10 +36,10 @@ import net.shibboleth.idp.attribute.resolver.ResolutionException;
 import net.shibboleth.idp.authn.AbstractSubjectCanonicalizationAction;
 import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.SubjectCanonicalizationException;
-import net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor;
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
 import net.shibboleth.idp.saml.authn.principal.NameIDPrincipal;
 import net.shibboleth.idp.saml.authn.principal.NameIdentifierPrincipal;
+import net.shibboleth.idp.saml.nameid.NameIDCanonicalizationFlowDescriptor;
 import net.shibboleth.utilities.java.support.annotation.ParameterName;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.DeprecationSupport;
@@ -48,7 +48,7 @@ import net.shibboleth.utilities.java.support.service.ReloadableService;
 import net.shibboleth.utilities.java.support.service.ServiceableComponent;
 
 /**
- * Action to perform C14N based on the contents of the attribute-resolver.xml file, this
+ * Action to perform c14n based on the contents of the attribute-resolver.xml file, this
  * delegates the work to an {@link AttributeResolver} instance that supports the
  * {@link LegacyPrincipalDecoder} interface.
  */
@@ -123,10 +123,10 @@ public class LegacyCanonicalization extends AbstractSubjectCanonicalizationActio
      * @param activationCondition - the activationCondition
      * @return an appropriate FlowDescriptor 
      */
-    public static SubjectCanonicalizationFlowDescriptor c14LegacyPrincipalConnectorFactory(
+    public static NameIDCanonicalizationFlowDescriptor c14LegacyPrincipalConnectorFactory(
                 final @ParameterName(name="activationCondition") Predicate<ProfileRequestContext> activationCondition) {
         DeprecationSupport.warn(ObjectType.BEAN, "c14n/LegacyPrincipalConnector", "c14n/subject-c14n.xml", "<remove>");
-        final SubjectCanonicalizationFlowDescriptor result = new SubjectCanonicalizationFlowDescriptor();
+        final NameIDCanonicalizationFlowDescriptor result = new NameIDCanonicalizationFlowDescriptor();
         result.setActivationCondition(activationCondition);
         return result;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list