Skip to content

Commit 086055b

Browse files
authored
Option to use endpoints starting with _security (#36379)
#36293 deprecates the /_xpack/security/* endpoints in favor of the /_security/* ones. This commit adds support for the new endpoints in 6.x to facilitate tests and normal operations in a mixed 6.x/7.x cluster
1 parent 666170a commit 086055b

26 files changed

+45
-1
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class RestGetCertificateInfoAction extends BaseRestHandler {
3131
public RestGetCertificateInfoAction(Settings settings, RestController controller) {
3232
super(settings);
3333
controller.registerHandler(GET, "/_xpack/ssl/certificates", this);
34+
controller.registerHandler(GET, "/_ssl/certificates", this);
3435
}
3536

3637
@Override
@@ -48,4 +49,4 @@ public RestResponse buildResponse(Response response, XContentBuilder builder) th
4849
}
4950
});
5051
}
51-
}
52+
}

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public RestAuthenticateAction(Settings settings, RestController controller, Secu
4040
super(settings, licenseState);
4141
this.securityContext = securityContext;
4242
controller.registerHandler(GET, "/_xpack/security/_authenticate", this);
43+
controller.registerHandler(GET, "/_security/_authenticate", this);
4344

4445
// @deprecated: Remove in 6.0
4546
controller.registerAsDeprecatedHandler(GET, "/_shield/authenticate", this,

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestGetTokenAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public final class RestGetTokenAction extends SecurityBaseRestHandler {
6161
public RestGetTokenAction(Settings settings, RestController controller, XPackLicenseState xPackLicenseState) {
6262
super(settings, xPackLicenseState);
6363
controller.registerHandler(POST, "/_xpack/security/oauth2/token", this);
64+
controller.registerHandler(POST, "/_/security/oauth2/token", this);
6465
}
6566

6667
@Override

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/oauth2/RestInvalidateTokenAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public final class RestInvalidateTokenAction extends SecurityBaseRestHandler {
4444
public RestInvalidateTokenAction(Settings settings, RestController controller, XPackLicenseState xPackLicenseState) {
4545
super(settings, xPackLicenseState);
4646
controller.registerHandler(DELETE, "/_xpack/security/oauth2/token", this);
47+
controller.registerHandler(DELETE, "/_security/oauth2/token", this);
4748
}
4849

4950
@Override

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestDeletePrivilegesAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class RestDeletePrivilegesAction extends SecurityBaseRestHandler {
3434
public RestDeletePrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
3535
super(settings, licenseState);
3636
controller.registerHandler(DELETE, "/_xpack/security/privilege/{application}/{privilege}", this);
37+
controller.registerHandler(DELETE, "/_security/privilege/{application}/{privilege}", this);
3738
}
3839

3940
@Override

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetPrivilegesAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ public class RestGetPrivilegesAction extends SecurityBaseRestHandler {
3939
public RestGetPrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
4040
super(settings, licenseState);
4141
controller.registerHandler(GET, "/_xpack/security/privilege/", this);
42+
controller.registerHandler(GET, "/_security/privilege/", this);
4243
controller.registerHandler(GET, "/_xpack/security/privilege/{application}", this);
44+
controller.registerHandler(GET, "/_security/privilege/{application}", this);
4345
controller.registerHandler(GET, "/_xpack/security/privilege/{application}/{privilege}", this);
46+
controller.registerHandler(GET, "/_security/privilege/{application}/{privilege}", this);
4447
}
4548

4649
@Override

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestPutPrivilegesAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public class RestPutPrivilegesAction extends SecurityBaseRestHandler {
3939
public RestPutPrivilegesAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
4040
super(settings, licenseState);
4141
controller.registerHandler(PUT, "/_xpack/security/privilege/", this);
42+
controller.registerHandler(PUT, "/_security/privilege/", this);
4243
controller.registerHandler(POST, "/_xpack/security/privilege/", this);
44+
controller.registerHandler(POST, "/_security/privilege/", this);
4345
}
4446

4547
@Override

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public final class RestClearRealmCacheAction extends SecurityBaseRestHandler {
2929
public RestClearRealmCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
3030
super(settings, licenseState);
3131
controller.registerHandler(POST, "/_xpack/security/realm/{realms}/_clear_cache", this);
32+
controller.registerHandler(POST, "/_security/realm/{realms}/_clear_cache", this);
3233

3334
// @deprecated: Remove in 6.0
3435
controller.registerAsDeprecatedHandler(POST, "/_shield/realm/{realms}/_cache/clear", this,

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public final class RestClearRolesCacheAction extends SecurityBaseRestHandler {
2929
public RestClearRolesCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
3030
super(settings, licenseState);
3131
controller.registerHandler(POST, "/_xpack/security/role/{name}/_clear_cache", this);
32+
controller.registerHandler(POST, "/_security/role/{name}/_clear_cache", this);
3233

3334
// @deprecated: Remove in 6.0
3435
controller.registerAsDeprecatedHandler(POST, "/_shield/role/{name}/_clear_cache", this,

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class RestDeleteRoleAction extends SecurityBaseRestHandler {
3636
public RestDeleteRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
3737
super(settings, licenseState);
3838
controller.registerHandler(DELETE, "/_xpack/security/role/{name}", this);
39+
controller.registerHandler(DELETE, "/_security/role/{name}", this);
3940

4041
// @deprecated: Remove in 6.0
4142
controller.registerAsDeprecatedHandler(DELETE, "/_shield/role/{name}", this,

0 commit comments

Comments
 (0)