[java-identity-provider] branch master updated: IDP-1328 Deprecate IdPAttribute names with non printing chars.

Rod Widdowson rdw at steadingsoftware.com
Tue Sep 11 12:11:44 EDT 2018


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

rdw 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=9e2de23108082c3f0e342fdf22c98d058f60c4c9

The following commit(s) were added to refs/heads/master by this push:
       new  9e2de23   IDP-1328 Deprecate IdPAttribute names with non printing chars.
9e2de23 is described below

commit 9e2de23108082c3f0e342fdf22c98d058f60c4c9
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 11 17:11:20 2018 +0100

    IDP-1328 Deprecate IdPAttribute names with non printing chars.
    
    https://issues.shibboleth.net/jira/browse/IDP-1328
---
 .../idp/attribute/resolver/AbstractAttributeDefinition.java          | 5 ++++-
 .../idp/attribute/resolver/AbstractAttributeDefinitionTest.java      | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
index 85846b1..aef26d1 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
@@ -24,6 +24,7 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.regex.Pattern;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -46,6 +47,7 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.util.PatternMatchUtils;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableMap;
@@ -228,11 +230,12 @@ public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin
         // The Id is now definitive. Just in case it was used prior to that, reset the getPrefixCache
         logPrefix = null;
         
-        if (getId().contains(" ")) {
+        if (Pattern.matches(".*\\s.*", getId())) {
             DeprecationSupport.warn(ObjectType.CONFIGURATION, 
                     "Use of IdP Attributes names with spaces in them", 
                     getLogPrefix(), 
                     null);
+            
         }
     }
 
diff --git a/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java b/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
index 1d62c87..43a6f0a 100644
--- a/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
+++ b/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
@@ -218,6 +218,8 @@ public class AbstractAttributeDefinitionTest {
     @Test public void invalidName() throws ComponentInitializationException {
         MockAttributeDefinition definition = new MockAttributeDefinition("Name With Space", (IdPAttribute) null);
         definition.initialize();
+        definition = new MockAttributeDefinition("Name\rWith\tnonprinters", (IdPAttribute) null);
+        definition.initialize();
     }
     
     @Test public void initDestroyValidate() throws ComponentInitializationException {

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


More information about the commits mailing list