[java-opensaml] branch master updated: Add buildScoping method.
Scott Cantor
cantor.2 at osu.edu
Wed Nov 27 10:38:04 EST 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=0e3d6f0361276eee8c365c44d141fe673e35881b
The following commit(s) were added to refs/heads/master by this push:
new 0e3d6f0 Add buildScoping method.
0e3d6f0 is described below
commit 0e3d6f0361276eee8c365c44d141fe673e35881b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Nov 27 10:37:57 2019 -0500
Add buildScoping method.
---
.../saml2/profile/SAML2ActionTestingSupport.java | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/opensaml-saml-api/src/test/java/org/opensaml/saml/saml2/profile/SAML2ActionTestingSupport.java b/opensaml-saml-api/src/test/java/org/opensaml/saml/saml2/profile/SAML2ActionTestingSupport.java
index 0934caa..0ace62c 100644
--- a/opensaml-saml-api/src/test/java/org/opensaml/saml/saml2/profile/SAML2ActionTestingSupport.java
+++ b/opensaml-saml-api/src/test/java/org/opensaml/saml/saml2/profile/SAML2ActionTestingSupport.java
@@ -18,10 +18,12 @@
package org.opensaml.saml.saml2.profile;
import java.time.Instant;
+import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
@@ -34,6 +36,8 @@ import org.opensaml.saml.saml2.core.ArtifactResponse;
import org.opensaml.saml.saml2.core.AttributeStatement;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.core.AuthnStatement;
+import org.opensaml.saml.saml2.core.IDPEntry;
+import org.opensaml.saml.saml2.core.IDPList;
import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml.saml2.core.AttributeQuery;
import org.opensaml.saml.saml2.core.Issuer;
@@ -41,6 +45,7 @@ import org.opensaml.saml.saml2.core.LogoutRequest;
import org.opensaml.saml.saml2.core.LogoutResponse;
import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.Response;
+import org.opensaml.saml.saml2.core.Scoping;
import org.opensaml.saml.saml2.core.Subject;
/**
@@ -309,6 +314,44 @@ public class SAML2ActionTestingSupport {
return request;
}
+
+ /**
+ * Build a {@Scoping}.
+ *
+ * @param count proxy count
+ * @param idplist list of IdP entityIDs
+ *
+ * @return populated {@link Scoping}
+ *
+ * @since 4.0.0
+ */
+ @Nonnull public static Scoping buildScoping(@Nullable final Integer count,
+ @Nullable @NonnullElements Set<String> idplist) {
+ final SAMLObjectBuilder<Scoping> scopingBuilder = (SAMLObjectBuilder<Scoping>)
+ XMLObjectProviderRegistrySupport.getBuilderFactory().<Scoping>getBuilderOrThrow(
+ Scoping.DEFAULT_ELEMENT_NAME);
+ final SAMLObjectBuilder<IDPList> idpListBuilder = (SAMLObjectBuilder<IDPList>)
+ XMLObjectProviderRegistrySupport.getBuilderFactory().<IDPList>getBuilderOrThrow(
+ IDPList.DEFAULT_ELEMENT_NAME);
+ final SAMLObjectBuilder<IDPEntry> idpBuilder = (SAMLObjectBuilder<IDPEntry>)
+ XMLObjectProviderRegistrySupport.getBuilderFactory().<IDPEntry>getBuilderOrThrow(
+ IDPEntry.DEFAULT_ELEMENT_NAME);
+
+ final Scoping scoping = scopingBuilder.buildObject();
+ scoping.setProxyCount(count);
+
+ if (idplist != null && !idplist.isEmpty()) {
+ final IDPList idps = idpListBuilder.buildObject();
+ for (final String idp : idplist) {
+ final IDPEntry entry = idpBuilder.buildObject();
+ entry.setProviderID(idp);
+ idps.getIDPEntrys().add(entry);
+ }
+ scoping.setIDPList(idps);
+ }
+
+ return scoping;
+ }
/**
* Builds a {@link ArtifactResolve}.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list