[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/nameid/impl/AttributeS...

noreply at shibboleth.net noreply at shibboleth.net
Sun May 24 15:37:26 EDT 2015


Author: scantor
Date: Sun May 24 15:37:25 2015
New Revision: 7532

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7532&view=rev
Log:
IDP-729 - adjust defaults for unfiltered attribute usage in NameID generators

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/PersistentSAML2NameIDGenerator.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/PersistentSAML2NameIDGeneratorTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/StoredPersistentIdDecoderTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java?rev=7532&r1=7531&r2=7532&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java	Sun May 24 15:37:25 2015
@@ -53,7 +53,6 @@
 
 import com.google.common.base.Function;
 import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 
@@ -69,8 +68,8 @@
     /** Strategy function to lookup AttributeContext. */
     @Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy;
 
-    /** Predicate to select whether to look at filtered or unfiltered attributes. */
-    @Nonnull private Predicate<ProfileRequestContext> useUnfilteredAttributes;
+    /** Whether to look at filtered or unfiltered attributes. */
+    private boolean useUnfilteredAttributes;
 
     /** Delimiter to use for scoped attribute serialization. */
     private char delimiter;
@@ -87,7 +86,7 @@
         attributeSourceIds = Collections.emptyList();
         setDefaultIdPNameQualifierLookupStrategy(new ResponderIdLookupFunction());
         setDefaultSPNameQualifierLookupStrategy(new RelyingPartyIdLookupFunction());
-        useUnfilteredAttributes = Predicates.alwaysFalse();
+        useUnfilteredAttributes = false;
     }
 
     /**
@@ -127,13 +126,12 @@
     }
 
     /**
-     * Set the Predicate which decides where to source the input attributes. If the predicate returns true then the
-     * unfiltered attributes are used. Otherwise the filtered ones (default behavior)
-     * 
-     * @param what the {@link Predicate} to set.
-     */
-    public void setUseUnfilteredAttributes(@Nonnull Predicate<ProfileRequestContext> what) {
-        useUnfilteredAttributes = Constraint.isNotNull(what, "UseUnfilteredAttributes predicate should be non null");
+     * Set whether to source the input attributes from the unfiltered attribute set.
+     * 
+     * @param flag flag to set
+     */
+    public void setUseUnfilteredAttributes(final boolean flag) {
+        useUnfilteredAttributes = flag;
     }
 
     /** {@inheritDoc} */
@@ -157,12 +155,8 @@
             return null;
         }
 
-        final Map<String, IdPAttribute> attributes;
-        if (useUnfilteredAttributes.apply(profileRequestContext)) {
-            attributes = attributeCtx.getUnfilteredIdPAttributes();
-        } else {
-            attributes = attributeCtx.getIdPAttributes();
-        }
+        final Map<String,IdPAttribute> attributes = useUnfilteredAttributes ? attributeCtx.getUnfilteredIdPAttributes()
+                : attributeCtx.getIdPAttributes();
 
         for (final String sourceId : attributeSourceIds) {
 
@@ -196,12 +190,8 @@
 
         final AttributeContext attributeCtx = attributeContextLookupStrategy.apply(profileRequestContext);
 
-        final Map<String, IdPAttribute> attributes;
-        if (useUnfilteredAttributes.apply(profileRequestContext)) {
-            attributes = attributeCtx.getUnfilteredIdPAttributes();
-        } else {
-            attributes = attributeCtx.getIdPAttributes();
-        }
+        final Map<String,IdPAttribute> attributes = useUnfilteredAttributes ? attributeCtx.getUnfilteredIdPAttributes()
+                : attributeCtx.getIdPAttributes();
 
         for (final String sourceId : attributeSourceIds) {
             log.debug("Checking for source attribute {}", sourceId);

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java?rev=7532&r1=7531&r2=7532&view=diff

[... 228 lines stripped ...]


More information about the commits mailing list