From 048c64b6bd27120f245474ebef52d193a8ce60ef Mon Sep 17 00:00:00 2001 From: mhajas Date: Mon, 7 Mar 2016 11:23:36 +0100 Subject: [PATCH] IdpInitiated login unauthorized test --- .../AbstractSAMLServletsAdapterTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java index 2d5645a104..2bdabc9870 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/AbstractSAMLServletsAdapterTest.java @@ -478,4 +478,21 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd employee2ServletPage.logout(); } + + @Test + public void idpInitiatedUnauthorizedLoginTest() { + samlidpInitiatedLogin.setAuthRealm(SAMLSERVLETDEMO); + samlidpInitiatedLogin.setUrlName("employee2"); + samlidpInitiatedLogin.navigateTo(); + samlidpInitiatedLogin.form().login("unauthorized","password"); + + assertFalse(driver.getPageSource().contains("principal=")); + assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403")); + + employee2ServletPage.navigateTo(); + assertFalse(driver.getPageSource().contains("principal=")); + assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403")); + + employee2ServletPage.logout(); + } }