Avoid using nip.io resolution in RefreshTokenTest#refreshTokenWithDifferentIssuer test

Closes #25675

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
rmartinc 2024-11-06 10:18:03 +01:00 committed by Marek Posolda
parent b2930a4799
commit d2e19da64e

View file

@ -309,7 +309,7 @@ public class RefreshTokenTest extends AbstractKeycloakTest {
@Test @Test
public void refreshTokenWithDifferentIssuer() throws Exception { public void refreshTokenWithDifferentIssuer() throws Exception {
final String proxyHost = "proxy.kc.127.0.0.1.nip.io"; final String proxyHost = "localhost";
final int httpPort = 8666; final int httpPort = 8666;
final int httpsPort = 8667; final int httpsPort = 8667;
@ -330,17 +330,20 @@ public class RefreshTokenTest extends AbstractKeycloakTest {
SimpleUndertowLoadBalancer proxy = new SimpleUndertowLoadBalancer(proxyHost, httpPort, httpsPort, "node1=" + getHttpAuthServerContextRoot() + "/auth"); SimpleUndertowLoadBalancer proxy = new SimpleUndertowLoadBalancer(proxyHost, httpPort, httpsPort, "node1=" + getHttpAuthServerContextRoot() + "/auth");
proxy.start(); proxy.start();
try {
oauth.baseUrl(String.format("http://%s:%s", proxyHost, httpPort)); oauth.baseUrl(String.format("http://%s:%s", proxyHost, httpPort));
response = oauth.doRefreshTokenRequest(refreshTokenString, "password"); response = oauth.doRefreshTokenRequest(refreshTokenString, "password");
Assert.assertEquals(400, response.getStatusCode()); Assert.assertEquals(400, response.getStatusCode());
Assert.assertEquals("invalid_grant", response.getError());
assertThat(response.getErrorDescription(), Matchers.startsWith("Invalid token issuer."));
events.expect(EventType.REFRESH_TOKEN).error(Errors.INVALID_TOKEN).user((String) null).assertEvent(); events.expect(EventType.REFRESH_TOKEN).error(Errors.INVALID_TOKEN).user((String) null).assertEvent();
} finally {
proxy.stop(); proxy.stop();
oauth.baseUrl(AUTH_SERVER_ROOT); oauth.baseUrl(AUTH_SERVER_ROOT);
} }
}
@Test @Test
public void refreshTokenWithAccessToken() throws Exception { public void refreshTokenWithAccessToken() throws Exception {
@ -352,7 +355,6 @@ public class RefreshTokenTest extends AbstractKeycloakTest {
String accessTokenString = tokenResponse.getAccessToken(); String accessTokenString = tokenResponse.getAccessToken();
OAuthClient.AccessTokenResponse response = oauth.doRefreshTokenRequest(accessTokenString, "password"); OAuthClient.AccessTokenResponse response = oauth.doRefreshTokenRequest(accessTokenString, "password");
Assert.assertNotEquals(200, response.getStatusCode()); Assert.assertNotEquals(200, response.getStatusCode());
} }