[java-identity-provider] branch main updated: IDP-1703 - More options for "direct" NameID consumption

Scott Cantor cantor.2 at osu.edu
Tue Dec 22 18:23:03 UTC 2020


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

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

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

The following commit(s) were added to refs/heads/main by this push:
       new  f23addaf6 IDP-1703 - More options for "direct" NameID consumption
f23addaf6 is described below

commit f23addaf67b78bf84241a8d2e3e29c43102c8413
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Dec 22 13:23:00 2020 -0500

    IDP-1703 - More options for "direct" NameID consumption
    
    https://issues.shibboleth.net/jira/browse/IDP-1703
    
    Add case folding properties.
---
 .../flows/c14n/subject-c14n-saml-default-beans.xml |  6 +++
 .../resources/conf/c14n/subject-c14n.properties    |  8 ++++
 .../saml/nameid/impl/BaseTransformingDecoder.java  | 46 +++++++++++++++++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/c14n/subject-c14n-saml-default-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/c14n/subject-c14n-saml-default-beans.xml
index b56206c16..d9907f6c1 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/c14n/subject-c14n-saml-default-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/c14n/subject-c14n-saml-default-beans.xml
@@ -44,6 +44,8 @@
             class="net.shibboleth.idp.saml.nameid.impl.NameIDCanonicalization" scope="prototype">
         <property name="decoder">
             <bean class="net.shibboleth.idp.saml.nameid.impl.TransformingNameIDDecoder"
+                p:lowercase="%{idp.c14n.saml.lowercase:false}"
+                p:uppercase="%{idp.c14n.saml.uppercase:false}"
                 p:transforms-ref="shibboleth.NameTransforms" />
         </property>
     </bean>
@@ -52,6 +54,8 @@
             class="net.shibboleth.idp.saml.nameid.impl.NameIDCanonicalization" scope="prototype">
         <property name="decoder">
             <bean class="net.shibboleth.idp.saml.nameid.impl.TransformingNameIDDecoder"
+                p:lowercase="%{idp.c14n.saml.lowercase:false}"
+                p:uppercase="%{idp.c14n.saml.uppercase:false}"
                 p:transforms-ref="shibboleth.ProxyNameTransforms" />
         </property>
     </bean>
@@ -76,6 +80,8 @@
             class="net.shibboleth.idp.saml.nameid.impl.NameIdentifierCanonicalization" scope="prototype">
         <property name="decoder">
             <bean class="net.shibboleth.idp.saml.nameid.impl.TransformingNameIdentifierDecoder"
+                p:lowercase="%{idp.c14n.saml.lowercase:false}"
+                p:uppercase="%{idp.c14n.saml.uppercase:false}"
                 p:transforms-ref="shibboleth.NameTransforms" />
         </property>
     </bean>
diff --git a/idp-conf/src/main/resources/conf/c14n/subject-c14n.properties b/idp-conf/src/main/resources/conf/c14n/subject-c14n.properties
index 617348bc1..8a2c8f4dc 100644
--- a/idp-conf/src/main/resources/conf/c14n/subject-c14n.properties
+++ b/idp-conf/src/main/resources/conf/c14n/subject-c14n.properties
@@ -27,3 +27,11 @@
 #idp.c14n.x500.subjectAltNameTypes = 
 # Comma-delimited list of OIDS
 #idp.c14n.x500.objectIDs = 
+
+# Proxied SAML NameID -> principal name c14n
+#idp.c14n.saml.proxy.lowercase = false
+#idp.c14n.saml.proxy.uppercase = false
+
+# NameID consumption from SAML requests
+#idp.c14n.saml.lowercase = false
+#idp.c14n.saml.uppercase = false
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseTransformingDecoder.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseTransformingDecoder.java
index 3f3de4dce..d81ec5214 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseTransformingDecoder.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseTransformingDecoder.java
@@ -38,7 +38,7 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** Regular expression transform of an identifier. */
+/** Regular expression, etc. transform of an identifier. */
 public abstract class BaseTransformingDecoder extends AbstractIdentifiableInitializableComponent {
 
     /** Class logger. */
@@ -47,11 +47,43 @@ public abstract class BaseTransformingDecoder extends AbstractIdentifiableInitia
     /** Match patterns and replacement strings to apply. */
     @Nonnull @NonnullElements private List<Pair<Pattern,String>> transforms;
     
+    /** Convert to uppercase prior to transforms? */
+    private boolean uppercase;
+    
+    /** Convert to lowercase prior to transforms? */
+    private boolean lowercase;
+    
     /** Constructor. */
     public BaseTransformingDecoder() {
         transforms = Collections.emptyList();
     }
     
+    /**
+     * Controls conversion to uppercase prior to applying any transforms.
+     * 
+     * @param flag  uppercase flag
+     * 
+     * @since 4.1.0
+     */
+    public void setUppercase(final boolean flag) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        uppercase = flag;
+    }
+
+    /**
+     * Controls conversion to lowercase prior to applying any transforms.
+     * 
+     * @param flag lowercase flag
+     * 
+     * @since 4.1.0
+     */
+    public void setLowercase(final boolean flag) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        lowercase = flag;
+    }
+    
     /**
      * A collection of regular expression and replacement pairs.
      * 
@@ -80,6 +112,18 @@ public abstract class BaseTransformingDecoder extends AbstractIdentifiableInitia
         
         String s = id;
         
+        if (lowercase) {
+            log.debug("Converting input string '{}' to lowercase", s);
+            s = s.toLowerCase();
+        } else if (uppercase) {
+            log.debug("Converting input string '{}' to uppercase", s);
+            s = s.toUpperCase();
+        }
+        
+        if (transforms.isEmpty()) {
+            return s;
+        }
+        
         for (final Pair<Pattern,String> p : transforms) {            
             final Matcher m = p.getFirst().matcher(s);
             log.debug("Applying replacement expression '{}' against input '{}'", p.getFirst().pattern(), s);

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


More information about the commits mailing list