[java-plugin-shibd-saml] branch main updated: Setting up some test files.

Scott Cantor cantor.2 at osu.edu
Tue Sep 17 20:29:13 UTC 2024


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

scantor pushed a commit to branch main
in repository java-plugin-shibd-saml.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd-saml.git;a=commit;h=cea5234913257eec072a8df6cc4407d28f442092

The following commit(s) were added to refs/heads/main by this push:
     new cea5234  Setting up some test files.
cea5234 is described below

commit cea5234913257eec072a8df6cc4407d28f442092
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 17 16:29:10 2024 -0400

    Setting up some test files.
---
 .../idp/flows/sp/consumer/saml2/saml2-flow.xml     |  3 +-
 .../idp/module/conf/attributes/default-rules.xml   | 31 +++++++++++++
 .../idp/module/conf/attributes/nameid-testing.xml  | 53 ++++++++++++++++++++++
 .../saml2/profile/impl/ExtractSAMLAttributes.java  | 19 +++++---
 4 files changed, 98 insertions(+), 8 deletions(-)

diff --git a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/saml2-flow.xml b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/saml2-flow.xml
index aea98b9..43e4533 100644
--- a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/saml2-flow.xml
+++ b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/saml2-flow.xml
@@ -25,9 +25,10 @@
 <!--        <evaluate expression="PostAssertionPopulateAuditContext" />-->
 <!--        <evaluate expression="PostResponsePopulateAuditContext" />-->
         
+        <evaluate expression="PrepareAgentResponse" />
         <evaluate expression="'proceed'" />
         
-        <transition on="proceed" to="TBD" />
+        <transition on="proceed" to="proceed" />
     </action-state>
     
     <!-- The file really exists in this directory, but it's referenced from extending flow-directories -->
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/default-rules.xml b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/default-rules.xml
new file mode 100644
index 0000000..96cb402
--- /dev/null
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/default-rules.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:c="http://www.springframework.org/schema/c"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+                           
+       default-init-method="initialize"
+       default-destroy-method="destroy">
+
+    <!-- Default Attribute transcoding rules. -->
+    
+    <!--
+    Many if not most of these attributes are not suited or may even be actively discouraged
+    from use in federated protocols, but this is merely a set of well-known definitions, not
+    a recommended set to support or use.
+    -->
+    
+    <import resource="inetOrgPerson.xml" />
+    <import resource="eduPerson.xml" />
+    <import resource="eduCourse.xml" />
+    <import resource="schac.xml" />
+    <import resource="samlSubject.xml" />
+
+    <import resource="nameid-testing.xml" />
+
+</beans>
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/nameid-testing.xml b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/nameid-testing.xml
new file mode 100644
index 0000000..976c294
--- /dev/null
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/attributes/nameid-testing.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:c="http://www.springframework.org/schema/c"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+                           
+       default-init-method="initialize"
+       default-destroy-method="destroy">
+
+    <!--
+    Note that all built-in rules rely on URI-naming and thus include the implied settings:
+    
+    <prop key="saml2.nameFormat">urn:oasis:names:tc:SAML:2.0:attrname-format:uri</prop>
+    <prop key="saml1.namespace">urn:mace:shibboleth:1.0:attributeNamespace:uri</prop>
+    -->
+
+    <!-- https://tools.ietf.org/html/rfc2798 -->
+
+    <bean parent="shibboleth.TranscodingRuleLoader">
+    <constructor-arg>
+    <list>
+
+        <bean parent="shibboleth.TranscodingProperties">
+            <property name="properties">
+                <props merge="true">
+                    <prop key="id">mail</prop>
+                    <prop key="transcoder">SAML2StringNameIDTranscoder</prop>
+                    <prop key="saml2.name">urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</prop>
+                    <prop key="displayName.en">E-mail</prop>
+                    <prop key="displayName.de">E-Mail</prop>
+                    <prop key="displayName.fr">Email</prop>
+                    <prop key="displayName.it">E-mail</prop>
+                    <prop key="displayName.ja">メールアドレス</prop>
+                    <prop key="description.en">E-Mail: Preferred address for e-mail to be sent to this person</prop>
+                    <prop key="description.de">E-Mail-Adresse</prop>
+                    <prop key="description.de-ch">E-Mail Adresse</prop>
+                    <prop key="description.fr">Adresse de courrier électronique</prop>
+                    <prop key="description.it">E-Mail: l'indirizzo e-mail preferito dall'utente</prop>
+                    <prop key="description.ja">メールアドレス</prop>
+                </props>
+            </property>
+        </bean>
+
+    </list>
+    </constructor-arg>
+    </bean>
+    
+</beans>
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
index d56f21c..acc6416 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
@@ -317,18 +317,23 @@ public class ExtractSAMLAttributes extends AbstractApplicationAction {
         final Multimap<String,IdPAttribute> mapped = HashMultimap.create();
         assert mapped != null;
 
+        final AuthnStatement theStatement = samlTokenContext.getAuthnStatement();
+        assert theStatement != null;
+        
         try (final ServiceableComponent<AttributeTranscoderRegistry> component =
                 ensureApplication().getAttributeTranscoderRegistry().getServiceableComponent()) {
             final Response response = getResponse(profileRequestContext);
             for (final Assertion assertion : response.getAssertions()) {
                 
-                final Subject subject = assertion.getSubject();
-                final NameID nameID = subject != null ? subject.getNameID() : null;
-                if (nameID != null) {
-                    try {
-                        decodeNameID(component.getComponent(), profileRequestContext, nameID, mapped);
-                    } catch (final AttributeDecodingException e) {
-                        log.error("{} Error decoding inbound NameID", getLogPrefix(), e);
+                if (assertion == theStatement.getParent()) {
+                    final Subject subject = assertion.getSubject();
+                    final NameID nameID = subject != null ? subject.getNameID() : null;
+                    if (nameID != null) {
+                        try {
+                            decodeNameID(component.getComponent(), profileRequestContext, nameID, mapped);
+                        } catch (final AttributeDecodingException e) {
+                            log.error("{} Error decoding inbound NameID", getLogPrefix(), e);
+                        }
                     }
                 }
                 

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


More information about the commits mailing list