Merge pull request #3686 from vramik/KEYCLOAK-3830

KEYCLOAK-3830 added missing test
This commit is contained in:
Stian Thorgersen 2016-12-22 05:56:27 +01:00 committed by GitHub
commit 6c8ebdb456
3 changed files with 32 additions and 0 deletions

View file

@ -17,6 +17,12 @@
<role-name>user_premium</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Public Resource</web-resource-name>
<url-pattern>/public-html.html</url-pattern>
</web-resource-collection>
</security-constraint>
<login-config>
<auth-method>KEYCLOAK</auth-method>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Public resource</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>This is public resource that should be accessible without login.</div>
</body>
</html>

View file

@ -268,6 +268,21 @@ public abstract class AbstractServletAuthzAdapterTest extends AbstractExampleAda
}
}
//KEYCLOAK-3830
@Test
public void testAccessPublicResource() throws Exception {
try {
this.deployer.deploy(RESOURCE_SERVER_ID);
driver.navigate().to(getResourceServerUrl() + "/public-html.html");
WaitUtils.waitForPageToLoad(driver);
assertTrue(hasText("This is public resource that should be accessible without login."));
} finally {
this.deployer.undeploy(RESOURCE_SERVER_ID);
}
}
private boolean hasLink(String text) {
return getLink(text) != null;
}