[java-idp-integration-tests] branch main updated: Test revoking consent from user prefs page.

Tom Zeller tzeller at dragonacea.biz
Fri Dec 15 12:58:49 UTC 2023


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

tzeller pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=88951e497d9d33e6b7fdffadea73c9223c0eebf8

The following commit(s) were added to refs/heads/main by this push:
     new 88951e4  Test revoking consent from user prefs page.
88951e4 is described below

commit 88951e497d9d33e6b7fdffadea73c9223c0eebf8
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Fri Dec 15 06:58:37 2023 -0600

    Test revoking consent from user prefs page.
    
    https://shibboleth.atlassian.net/browse/IDP-2175
---
 .../idp/integration/tests/BaseIntegrationTest.java | 12 ++++
 .../tests/saml2/AbstractSAML2IntegrationTest.java  | 84 ++++++++++++++++++++++
 .../saml2/SAML2SSORedirectIntegrationTest.java     |  5 ++
 3 files changed, 101 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
index ec9f37e..5c82d02 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -241,6 +241,9 @@ public abstract class BaseIntegrationTest {
     /** Name of form input element containing consent IDs. */
     public final static String CONSENT_IDS_INPUT_NAME = "_shib_idp_consentIds";
 
+    /** ID of checkbox to revoke consent. */
+    public final static String REVOKE_CONSENT_ID = "revokeConsent";
+
     /** Name of form input element to submit form. */
     public final static String SUBMIT_FORM_INPUT_NAME = "_eventId_proceed";
 
@@ -1960,6 +1963,15 @@ public abstract class BaseIntegrationTest {
         });
     }
 
+    /**
+     * Get and wait for user prefs page.
+     */
+    public void getAndWaitForUserPrefsPage() {
+        final String userPrefsPath = "/idp/profile/user/prefs";
+        driver.get(getBaseURL() + userPrefsPath);
+        waitForPageWithURL(getBaseURL() + userPrefsPath);
+    }
+
     /**
      * Wait for IdP logout page at URL composed of {@link #getBaseURL()} and {@link #idpLogoutURLPath}.
      */
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/saml2/AbstractSAML2IntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/saml2/AbstractSAML2IntegrationTest.java
index 382f8f5..9a0eebb 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/saml2/AbstractSAML2IntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/saml2/AbstractSAML2IntegrationTest.java
@@ -839,4 +839,88 @@ public abstract class AbstractSAML2IntegrationTest extends BaseIntegrationTest {
         validateResponse();
     }
 
+    public void testUserPrefsRevokeConsent(@Nullable final BrowserData browserData) throws Exception {
+        startSeleniumClient(browserData);
+
+        enableModules("idp.UserPrefs");
+
+        assertModulesAreEnabled("idp.UserPrefs");
+
+        startServer();
+
+        startFlow();
+
+        waitForLoginPage();
+
+        login();
+
+        // attribute release
+
+        waitForAttributeReleasePage();
+
+        releaseAllAttributes();
+
+        rememberConsent();
+
+        submitForm();
+
+        // response
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // start login flow again
+
+        startFlow();
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // user prefs page
+
+        getAndWaitForUserPrefsPage();
+
+        // check the un-checked revoke consent checkbox
+        WebElement revokeConsentCheckbox = driver.findElement(By.id(REVOKE_CONSENT_ID));
+        Assert.assertFalse(revokeConsentCheckbox.isSelected());
+        clickWorkaround(revokeConsentCheckbox);
+
+        // start login flow again, should prompt for consent
+
+        startFlow();
+
+        // attribute release
+
+        waitForAttributeReleasePage();
+
+        releaseAllAttributes();
+
+        rememberConsent();
+
+        submitForm();
+
+        // response
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // start login flow again, should not prompt for consent
+
+        startFlow();
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // revoke consent checkbox should not be checked
+
+        getAndWaitForUserPrefsPage();
+
+        revokeConsentCheckbox = driver.findElement(By.id(REVOKE_CONSENT_ID));
+        Assert.assertFalse(revokeConsentCheckbox.isSelected());
+    }
+
 }
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/saml2/SAML2SSORedirectIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/saml2/SAML2SSORedirectIntegrationTest.java
index f1bd64e..0a637a3 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/saml2/SAML2SSORedirectIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/saml2/SAML2SSORedirectIntegrationTest.java
@@ -107,4 +107,9 @@ public class SAML2SSORedirectIntegrationTest extends AbstractSAML2IntegrationTes
         super.testSLO(browserData);
     }
 
+    @Test(dataProvider = "sauceOnDemandBrowserDataProvider")
+    public void testUserPrefsRevokeConsent(@Nullable final BrowserData browserData) throws Exception {
+        super.testUserPrefsRevokeConsent(browserData);
+    }
+
 }

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


More information about the commits mailing list