[java-idp-testbed] branch main updated: Add more Scoping options.

Scott Cantor cantor.2 at osu.edu
Tue Mar 22 15:11:57 UTC 2022


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

scantor pushed a commit to branch main
in repository java-idp-testbed.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-testbed.git;a=commit;h=87dde963bc27da11761f2ee6393610f3c8fb55ce

The following commit(s) were added to refs/heads/main by this push:
     new 87dde96  Add more Scoping options.
87dde96 is described below

commit 87dde963bc27da11761f2ee6393610f3c8fb55ce
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 22 11:11:54 2022 -0400

    Add more Scoping options.
---
 src/main/java/sp/SAML2Controller.java             | 39 ++++++++++++++++++++---
 src/main/resources/system/conf/logback-access.xml | 12 -------
 src/main/webapp/index.html                        |  4 ++-
 3 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/src/main/java/sp/SAML2Controller.java b/src/main/java/sp/SAML2Controller.java
index 53c13b8..edcf821 100644
--- a/src/main/java/sp/SAML2Controller.java
+++ b/src/main/java/sp/SAML2Controller.java
@@ -55,6 +55,8 @@ import org.opensaml.saml.saml2.core.AttributeQuery;
 import org.opensaml.saml.saml2.core.AuthnContextClassRef;
 import org.opensaml.saml.saml2.core.AuthnRequest;
 import org.opensaml.saml.saml2.core.Extensions;
+import org.opensaml.saml.saml2.core.IDPEntry;
+import org.opensaml.saml.saml2.core.IDPList;
 import org.opensaml.saml.saml2.core.Issuer;
 import org.opensaml.saml.saml2.core.LogoutRequest;
 import org.opensaml.saml.saml2.core.LogoutResponse;
@@ -536,19 +538,48 @@ public class SAML2Controller extends BaseSAMLController {
 		if (param != null) {
 		    final String[] requesters = param.split(",");
 		    if (requesters != null && requesters.length > 0) {
-	            final Scoping scoping = (Scoping) builderFactory.getBuilder(
-	                    Scoping.DEFAULT_ELEMENT_NAME).buildObject(Scoping.DEFAULT_ELEMENT_NAME);
 	            for (final String req : requesters) {
 	                final RequesterID requesterID = (RequesterID) builderFactory.getBuilder(
 	                        RequesterID.DEFAULT_ELEMENT_NAME).buildObject(RequesterID.DEFAULT_ELEMENT_NAME);
 	                requesterID.setURI(req);
-	                scoping.getRequesterIDs().add(requesterID);
+	                getScoping(authnRequest).getRequesterIDs().add(requesterID);
 	            }
-	            authnRequest.setScoping(scoping);
 		    }
 		}
+		
+        param = StringSupport.trimOrNull(servletRequest.getParameter("idplist"));
+        if (param != null) {
+            final String[] idplist = param.split(",");
+            if (idplist != null && idplist.length > 0) {
+                final IDPList obj = (IDPList) builderFactory.getBuilder(
+                        IDPList.DEFAULT_ELEMENT_NAME).buildObject(IDPList.DEFAULT_ELEMENT_NAME);
+                for (final String idp : idplist) {
+                    final IDPEntry entry = (IDPEntry) builderFactory.getBuilder(
+                            IDPEntry.DEFAULT_ELEMENT_NAME).buildObject(IDPEntry.DEFAULT_ELEMENT_NAME);
+                    entry.setProviderID(idp);
+                    obj.getIDPEntrys().add(entry);
+                }
+                getScoping(authnRequest).setIDPList(obj);
+            }
+        }
+
+        param = StringSupport.trimOrNull(servletRequest.getParameter("proxycount"));
+        if (param != null) {
+            getScoping(authnRequest).setProxyCount(Integer.valueOf(param));
+        }
+        
 		return authnRequest;
 	}
+	
+	private Scoping getScoping(@Nonnull final AuthnRequest request) {
+	    if (request.getScoping() == null) {
+            final Scoping scoping = (Scoping) builderFactory.getBuilder(
+                    Scoping.DEFAULT_ELEMENT_NAME).buildObject(Scoping.DEFAULT_ELEMENT_NAME);
+            request.setScoping(scoping);
+	    }
+	    
+	    return request.getScoping();
+	}
 
     private Extensions buildRequestedAttributesExtensions()
     {
diff --git a/src/main/resources/system/conf/logback-access.xml b/src/main/resources/system/conf/logback-access.xml
deleted file mode 100644
index 1232f7f..0000000
--- a/src/main/resources/system/conf/logback-access.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<configuration>
-    <!-- always a good activate OnConsoleStatusListener -->
-    <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%h %l %u %user %date "%r" %s %b%n%n%fullRequest%n%n%fullResponse</pattern>
-        </encoder>
-    </appender>
-
-    <appender-ref ref="STDOUT" />
-</configuration>
diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html
index 9aba0c4..787074c 100644
--- a/src/main/webapp/index.html
+++ b/src/main/webapp/index.html
@@ -28,7 +28,9 @@
 <form action="sp/SAML2/InitSSO/Redirect" method="GET">
     <p>Init SAML 2 SSO, Redirect Binding with:<br/>
     AuthnContextClassRef: <input type="text" name="classRef" size="60"/><br/>
-    Scoping: <input type="text" name="requesters" size="60"/><br/>
+    Scoping ProxyCount: <input type="text" name="proxycount" size="20"/><br/>
+    Scoping Requesters: <input type="text" name="requesters" size="60"/><br/>
+    Scoping IdPs: <input type="text" name="idplist" size="60"/><br/>
     NameID Format: <input type="text" name="nameIDFormat" size="60"/><br/>
     SPNameQualifier: <input type="text" name="spNameQualifier" size="60"/><br/>
     Subject NameID: <input type="text" name="subjectID" size="60"/><br/>

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


More information about the commits mailing list