[java-idp-integration-tests] branch master updated: IDP-1026 - Test that empty attributes are omitted from consent
Tom Zeller
tzeller at dragonacea.biz
Mon Oct 17 16:33:58 EDT 2016
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch master
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=1fa8539f9880753ed2eab3a2385eeb213da133e8
The following commit(s) were added to refs/heads/master by this push:
new 1fa8539 IDP-1026 - Test that empty attributes are omitted from consent
1fa8539 is described below
commit 1fa8539f9880753ed2eab3a2385eeb213da133e8
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Mon Oct 17 15:32:14 2016 -0500
IDP-1026 - Test that empty attributes are omitted from consent
https://issues.shibboleth.net/jira/browse/IDP-1026
---
.../shibboleth/idp/test/BaseIntegrationTest.java | 16 ++++-
.../saml2/SAML2SSORedirectLDAPIntegrationTest.java | 84 ++++++++++++++++++++++
2 files changed, 99 insertions(+), 1 deletion(-)
diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 5186d81..5f011eb 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -1392,9 +1392,23 @@ public abstract class BaseIntegrationTest
* </ul>
*/
public void login() {
+ login("jdoe");
+ }
+
+
+ /**
+ * <ul>
+ * <li>Input username</li>
+ * <li>Input password</li>
+ * <li>Submit form.</li>
+ * </ul>
+ *
+ * @param user username
+ */
+ public void login(final @Nonnull String user) {
final WebElement username = driver.findElement(By.name("j_username"));
final WebElement password = driver.findElement(By.name("j_password"));
- username.sendKeys("jdoe");
+ username.sendKeys(user);
password.sendKeys("changeit");
submitForm();
}
diff --git a/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java
index 4f41d90..11f9bfc 100644
--- a/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java
@@ -17,8 +17,19 @@
package net.shibboleth.idp.test.saml2;
+import java.util.List;
+
import javax.annotation.Nullable;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.opensaml.core.xml.XMLObjectBuilder;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.schema.XSAny;
+import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.saml1.core.AttributeValue;
+import org.opensaml.saml.saml2.core.Attribute;
+import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -51,4 +62,77 @@ public class SAML2SSORedirectLDAPIntegrationTest extends AbstractSAML2Integratio
public void testSSOReleaseLDAPAttributes(@Nullable final BrowserData browserData) throws Exception {
super.testSSOReleaseLDAPAttributes(browserData);
}
+
+ public void setUpIDP1026Validator() {
+
+ final SAMLObjectBuilder<Attribute> builder = (SAMLObjectBuilder<Attribute>) XMLObjectProviderRegistrySupport
+ .getBuilderFactory().<Attribute> getBuilderOrThrow(Attribute.DEFAULT_ELEMENT_NAME);
+
+ final XMLObjectBuilder<XSAny> anyBuilder =
+ XMLObjectProviderRegistrySupport.getBuilderFactory().<XSAny> getBuilderOrThrow(XSAny.TYPE_NAME);
+
+ // the expected uid attribute
+ final Attribute uidAttribute = builder.buildObject();
+ uidAttribute.setName("urn:oid:0.9.2342.19200300.100.1.1");
+ uidAttribute.setNameFormat(Attribute.URI_REFERENCE);
+ uidAttribute.setFriendlyName("uid");
+ final XSAny uidValue = anyBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME);
+ uidValue.setTextContent("IDP-1026");
+ uidAttribute.getAttributeValues().add(uidValue);
+
+ validator.expectedAttributes.clear();
+ validator.expectedAttributes.add(uidAttribute);
+ }
+
+ @Test(dataProvider = "sauceOnDemandBrowserDataProvider")
+ public void testIDP1026(@Nullable final BrowserData browserData) throws Exception {
+
+ setUpIDP1026Validator();
+
+ enableAttributeResolverLDAP();
+
+ startSeleniumClient(browserData);
+
+ startServer();
+
+ startFlow();
+
+ waitForLoginPage();
+
+ login("IDP-1026");
+
+ // attribute release
+
+ waitForAttributeReleasePage();
+
+ // fail if mail attribute is displayed
+
+ final WebElement table = driver.findElement(By.tagName("table"));
+ final List<WebElement> tds = table.findElements(By.tagName("td"));
+ for (final WebElement td : tds) {
+ Assert.assertNotEquals("mail", td.getText(), "Emtpy mail attribute should not be displayed");
+ Assert.assertNotEquals("ZERO_LENGTH_VALUE", td.getText(), "Emtpy attributes should not be displayed");
+ Assert.assertNotEquals("NULL_VALUE", td.getText(), "Emtpy attributes should not be displayed");
+ }
+
+ releaseAllAttributes();
+
+ rememberConsent();
+
+ submitForm();
+
+ // response
+
+ waitForResponsePage();
+
+ validateResponse();
+
+ // twice
+
+ startFlow();
+
+ waitForResponsePage();
+
+ validateResponse();
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list