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;
|
||||
handlePushNotBefore();
|
||||
return true;
|
||||
} else if (requestUri.endsWith(AdapterConstants.K_VERSION)) {
|
||||
handleVersion();
|
||||
return true;
|
||||
} else if (requestUri.endsWith(AdapterConstants.K_TEST_AVAILABLE)) {
|
||||
if (!resolveDeployment()) return true;
|
||||
handleTestAvailable();
|
||||
|
@ -246,25 +243,6 @@ public class PreAuthActionsHandler {
|
|||
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() {
|
||||
try {
|
||||
JSONWebKeySet jwks = new JSONWebKeySet();
|
||||
|
|
|
@ -37,8 +37,7 @@ public class KeycloakCsrfRequestMatcher implements RequestMatcher {
|
|||
AdapterConstants.K_LOGOUT,
|
||||
AdapterConstants.K_PUSH_NOT_BEFORE,
|
||||
AdapterConstants.K_QUERY_BEARER_TOKEN,
|
||||
AdapterConstants.K_TEST_AVAILABLE,
|
||||
AdapterConstants.K_VERSION
|
||||
AdapterConstants.K_TEST_AVAILABLE
|
||||
);
|
||||
|
||||
private Pattern allowedMethods = Pattern.compile("^(GET|HEAD|TRACE|OPTIONS)$");
|
||||
|
|
|
@ -98,16 +98,6 @@ public class KeycloakCsrfRequestMatcherTest {
|
|||
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) {
|
||||
request.setMethod(method.name());
|
||||
request.setContextPath(contextPath);
|
||||
|
|
|
@ -25,7 +25,6 @@ public interface AdapterConstants {
|
|||
|
||||
// URL endpoints
|
||||
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_TEST_AVAILABLE = "k_test_available";
|
||||
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.serverInfo = [];
|
||||
$scope.realm = [];
|
||||
$scope.version = [];
|
||||
$scope.reloadData = function() {
|
||||
$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);
|
||||
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
|
@ -179,8 +179,6 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {
|
|||
jsDriverAngularCorsProductPage.navigateTo();
|
||||
waitForPageToLoad();
|
||||
|
||||
jsDriverAngularCorsProductPage.loadVersion();
|
||||
waitUntilElement(jsDriverAngularCorsProductPage.getOutput()).text().contains("Keycloak version: " + serverVersion);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -669,26 +669,6 @@ public class DemoServletsAdapterTest extends AbstractServletsAdapterTest {
|
|||
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
|
||||
public void testAuthenticated() {
|
||||
// test login to customer-portal which does a bearer request to customer-db
|
||||
|
|
Loading…
Reference in a new issue