KEYCLOAK-8785 remove k_version endpoint (#6428)
This commit is contained in:
parent
ecae2c5772
commit
d0386dab85
7 changed files with 1 additions and 64 deletions
|
@ -84,9 +84,6 @@ public class PreAuthActionsHandler {
|
||||||
if (!resolveDeployment()) return true;
|
if (!resolveDeployment()) return true;
|
||||||
handlePushNotBefore();
|
handlePushNotBefore();
|
||||||
return true;
|
return true;
|
||||||
} else if (requestUri.endsWith(AdapterConstants.K_VERSION)) {
|
|
||||||
handleVersion();
|
|
||||||
return true;
|
|
||||||
} else if (requestUri.endsWith(AdapterConstants.K_TEST_AVAILABLE)) {
|
} else if (requestUri.endsWith(AdapterConstants.K_TEST_AVAILABLE)) {
|
||||||
if (!resolveDeployment()) return true;
|
if (!resolveDeployment()) return true;
|
||||||
handleTestAvailable();
|
handleTestAvailable();
|
||||||
|
@ -246,25 +243,6 @@ public class PreAuthActionsHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleVersion() {
|
|
||||||
try {
|
|
||||||
facade.getResponse().setStatus(200);
|
|
||||||
KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);
|
|
||||||
if (deployment.isCors()) {
|
|
||||||
String origin = facade.getRequest().getHeader(CorsHeaders.ORIGIN);
|
|
||||||
if (origin == null) {
|
|
||||||
log.debug("no origin header set in request");
|
|
||||||
} else {
|
|
||||||
facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
facade.getResponse().setHeader("Content-Type", "application/json");
|
|
||||||
JsonSerialization.writeValueToStream(facade.getResponse().getOutputStream(), VersionRepresentation.SINGLETON);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void handleJwksRequest() {
|
protected void handleJwksRequest() {
|
||||||
try {
|
try {
|
||||||
JSONWebKeySet jwks = new JSONWebKeySet();
|
JSONWebKeySet jwks = new JSONWebKeySet();
|
||||||
|
|
|
@ -37,8 +37,7 @@ public class KeycloakCsrfRequestMatcher implements RequestMatcher {
|
||||||
AdapterConstants.K_LOGOUT,
|
AdapterConstants.K_LOGOUT,
|
||||||
AdapterConstants.K_PUSH_NOT_BEFORE,
|
AdapterConstants.K_PUSH_NOT_BEFORE,
|
||||||
AdapterConstants.K_QUERY_BEARER_TOKEN,
|
AdapterConstants.K_QUERY_BEARER_TOKEN,
|
||||||
AdapterConstants.K_TEST_AVAILABLE,
|
AdapterConstants.K_TEST_AVAILABLE
|
||||||
AdapterConstants.K_VERSION
|
|
||||||
);
|
);
|
||||||
|
|
||||||
private Pattern allowedMethods = Pattern.compile("^(GET|HEAD|TRACE|OPTIONS)$");
|
private Pattern allowedMethods = Pattern.compile("^(GET|HEAD|TRACE|OPTIONS)$");
|
||||||
|
|
|
@ -98,16 +98,6 @@ public class KeycloakCsrfRequestMatcherTest {
|
||||||
assertFalse(matcher.matches(request));
|
assertFalse(matcher.matches(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMatchesKeycloakVersion() throws Exception {
|
|
||||||
|
|
||||||
prepareRequest(HttpMethod.POST, ROOT_CONTEXT_PATH, AdapterConstants.K_VERSION);
|
|
||||||
assertFalse(matcher.matches(request));
|
|
||||||
|
|
||||||
prepareRequest(HttpMethod.POST, SUB_CONTEXT_PATH, AdapterConstants.K_VERSION);
|
|
||||||
assertFalse(matcher.matches(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void prepareRequest(HttpMethod method, String contextPath, String uri) {
|
private void prepareRequest(HttpMethod method, String contextPath, String uri) {
|
||||||
request.setMethod(method.name());
|
request.setMethod(method.name());
|
||||||
request.setContextPath(contextPath);
|
request.setContextPath(contextPath);
|
||||||
|
|
|
@ -25,7 +25,6 @@ public interface AdapterConstants {
|
||||||
|
|
||||||
// URL endpoints
|
// URL endpoints
|
||||||
public static final String K_LOGOUT = "k_logout";
|
public static final String K_LOGOUT = "k_logout";
|
||||||
public static final String K_VERSION = "k_version";
|
|
||||||
public static final String K_PUSH_NOT_BEFORE = "k_push_not_before";
|
public static final String K_PUSH_NOT_BEFORE = "k_push_not_before";
|
||||||
public static final String K_TEST_AVAILABLE = "k_test_available";
|
public static final String K_TEST_AVAILABLE = "k_test_available";
|
||||||
public static final String K_QUERY_BEARER_TOKEN = "k_query_bearer_token";
|
public static final String K_QUERY_BEARER_TOKEN = "k_query_bearer_token";
|
||||||
|
|
|
@ -67,7 +67,6 @@ module.controller('GlobalCtrl', function($scope, $http) {
|
||||||
$scope.roles = [];
|
$scope.roles = [];
|
||||||
$scope.serverInfo = [];
|
$scope.serverInfo = [];
|
||||||
$scope.realm = [];
|
$scope.realm = [];
|
||||||
$scope.version = [];
|
|
||||||
$scope.reloadData = function() {
|
$scope.reloadData = function() {
|
||||||
$http.get(getAppServerUrl("localhost-db-127.0.0.1.nip.io") + "/cors-database/products").success(function(data, status, headers, config) {
|
$http.get(getAppServerUrl("localhost-db-127.0.0.1.nip.io") + "/cors-database/products").success(function(data, status, headers, config) {
|
||||||
$scope.products = angular.fromJson(data);
|
$scope.products = angular.fromJson(data);
|
||||||
|
@ -108,12 +107,6 @@ module.controller('GlobalCtrl', function($scope, $http) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.loadVersion = function() {
|
|
||||||
$http.get(getAppServerUrl("localhost-db-127.0.0.1.nip.io") + "/cors-database/products/k_version").success(function(data) {
|
|
||||||
$scope.version = angular.fromJson(data);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.logout = logout;
|
$scope.logout = logout;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -179,8 +179,6 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {
|
||||||
jsDriverAngularCorsProductPage.navigateTo();
|
jsDriverAngularCorsProductPage.navigateTo();
|
||||||
waitForPageToLoad();
|
waitForPageToLoad();
|
||||||
|
|
||||||
jsDriverAngularCorsProductPage.loadVersion();
|
|
||||||
waitUntilElement(jsDriverAngularCorsProductPage.getOutput()).text().contains("Keycloak version: " + serverVersion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -669,26 +669,6 @@ public class DemoServletsAdapterTest extends AbstractServletsAdapterTest {
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testVersion() {
|
|
||||||
String serverVersion = adminClient.serverInfo().getInfo().getSystemInfo().getVersion();
|
|
||||||
|
|
||||||
assertNotNull(serverVersion);
|
|
||||||
|
|
||||||
Client client = ClientBuilder.newClient();
|
|
||||||
|
|
||||||
VersionRepresentation version2 = client.target(securePortal.toString()).path(AdapterConstants.K_VERSION).request().get(VersionRepresentation.class);
|
|
||||||
assertNotNull(version2);
|
|
||||||
assertNotNull(version2.getVersion());
|
|
||||||
assertNotNull(version2.getBuildTime());
|
|
||||||
|
|
||||||
log.info("version is " + version2.getVersion());
|
|
||||||
if (!suiteContext.isAdapterCompatTesting()) {
|
|
||||||
assertEquals(serverVersion, version2.getVersion());
|
|
||||||
}
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAuthenticated() {
|
public void testAuthenticated() {
|
||||||
// test login to customer-portal which does a bearer request to customer-db
|
// test login to customer-portal which does a bearer request to customer-db
|
||||||
|
|
Loading…
Reference in a new issue