Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4bad1fea86
5 changed files with 26 additions and 10 deletions
|
@ -78,9 +78,11 @@ public class AdapterDeploymentContext {
|
|||
if (deployment == null) return null;
|
||||
if (deployment.getAuthServerBaseUrl() == null) return deployment;
|
||||
|
||||
deployment = resolveUrls(deployment, facade);
|
||||
if (deployment.getRealmKey() == null) resolveRealmKey(deployment);
|
||||
return deployment;
|
||||
KeycloakDeployment resolvedDeployment = resolveUrls(deployment, facade);
|
||||
if (resolvedDeployment.getRealmKey() == null) {
|
||||
resolveRealmKey(resolvedDeployment);
|
||||
}
|
||||
return resolvedDeployment;
|
||||
}
|
||||
|
||||
protected KeycloakDeployment resolveUrls(KeycloakDeployment deployment, HttpFacade facade) {
|
||||
|
@ -404,6 +406,16 @@ public class AdapterDeploymentContext {
|
|||
public boolean isRegisterNodeAtStartup() {
|
||||
return delegate.isRegisterNodeAtStartup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrincipalAttribute() {
|
||||
return delegate.getPrincipalAttribute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrincipalAttribute(String principalAttribute) {
|
||||
delegate.setPrincipalAttribute(principalAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
protected KeycloakUriBuilder getBaseBuilder(HttpFacade facade, String base) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class KeycloakDeployment {
|
|||
|
||||
protected RelativeUrlsUsed relativeUrls;
|
||||
protected String realm;
|
||||
protected PublicKey realmKey;
|
||||
protected volatile PublicKey realmKey;
|
||||
protected String authServerBaseUrl;
|
||||
protected String realmInfoUrl;
|
||||
protected KeycloakUriBuilder authUrl;
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.keycloak.testsuite.rule.AbstractKeycloakRule;
|
|||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.keycloak.testutils.KeycloakServer;
|
||||
import org.keycloak.util.Time;
|
||||
import org.openqa.selenium.Cookie;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
|
@ -90,15 +91,16 @@ public class CookieTokenStoreAdapterTest {
|
|||
KeycloakSession session = keycloakRule.startSession();
|
||||
RealmModel realm = session.realms().getRealmByName("demo");
|
||||
int originalTokenTimeout = realm.getAccessTokenLifespan();
|
||||
realm.setAccessTokenLifespan(1);
|
||||
realm.setAccessTokenLifespan(3);
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
|
||||
// login to customer-cookie-portal
|
||||
String tokenCookie1 = loginToCustomerCookiePortal();
|
||||
|
||||
// wait 2 secs
|
||||
Thread.sleep(2000);
|
||||
// Simulate waiting 4 seconds (Running testsuite in real env like Wildfly or EAP may still require to do Thread.sleep to really wait 4 seconds...)
|
||||
Time.setOffset(4);
|
||||
//Thread.sleep(4000);
|
||||
|
||||
// assert cookie was refreshed
|
||||
driver.navigate().to("http://localhost:8081/customer-cookie-portal");
|
||||
|
@ -117,14 +119,15 @@ public class CookieTokenStoreAdapterTest {
|
|||
driver.navigate().to("http://localhost:8081/customer-portal");
|
||||
Assert.assertTrue(driver.getCurrentUrl().startsWith(LOGIN_URL));
|
||||
|
||||
// wait 2 secs until accessToken expires for customer-cookie-portal too.
|
||||
Thread.sleep(2000);
|
||||
// Simulate another 4 seconds
|
||||
Time.setOffset(8);
|
||||
|
||||
// assert not logged in customer-cookie-portal
|
||||
driver.navigate().to("http://localhost:8081/customer-cookie-portal");
|
||||
Assert.assertTrue(driver.getCurrentUrl().startsWith(LOGIN_URL));
|
||||
|
||||
// Change timeout back
|
||||
Time.setOffset(0);
|
||||
session = keycloakRule.startSession();
|
||||
realm = session.realms().getRealmByName("demo");
|
||||
realm.setAccessTokenLifespan(originalTokenTimeout);
|
||||
|
|
|
@ -52,6 +52,7 @@ public class TomcatServer {
|
|||
|
||||
server = new Embedded();
|
||||
server.setName("TomcatEmbeddedServer");
|
||||
server.setCatalinaBase(TomcatTest.getBaseDirectory());
|
||||
|
||||
Host localHost = server.createHost("localhost", appBase);
|
||||
localHost.setAutoDeploy(false);
|
||||
|
|
|
@ -162,7 +162,7 @@ public class TomcatTest {
|
|||
}
|
||||
|
||||
|
||||
private static String getBaseDirectory() {
|
||||
static String getBaseDirectory() {
|
||||
String dirPath = null;
|
||||
String relativeDirPath = "testsuite" + File.separator + "tomcat6" + File.separator + "target";
|
||||
|
||||
|
|
Loading…
Reference in a new issue