Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate /_xpack/security/* in favor of /_security/* #36293

Merged
merged 22 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8fba077
This commit is part of our plan to deprecate and ultimately remove th…
jkakavas Dec 6, 2018
042f785
Consistent leading slash use
jkakavas Dec 6, 2018
b4671bd
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 6, 2018
ed7f5ed
rename missed test
jkakavas Dec 6, 2018
d7f3175
handle _ssl/certificates correctly
jkakavas Dec 6, 2018
600db96
Fix XDocsClientYamlTestSuiteIT tests
jkakavas Dec 6, 2018
b12c66c
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 6, 2018
a77dcd8
(properly) Fix XDocsClientYamlTestSuiteIT tests
jkakavas Dec 6, 2018
ff242e8
Fix FullClusterRestartIT
jkakavas Dec 6, 2018
8d1496b
Fix TokenBackwardsCompatibilityIT
jkakavas Dec 7, 2018
fff0ea2
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 7, 2018
a509387
Fix Rolling Upgrade tests
jkakavas Dec 7, 2018
5b6ac27
Revert "Fix Rolling Upgrade tests"
jkakavas Dec 7, 2018
c902e68
Revert "Fix FullClusterRestartIT"
jkakavas Dec 7, 2018
f1ef843
Revert "Fix TokenBackwardsCompatibilityIT"
jkakavas Dec 7, 2018
1c04f05
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 9, 2018
cdd4751
Handle put privilege HLRC
jkakavas Dec 9, 2018
106be66
Revert "Revert "Fix FullClusterRestartIT""
jkakavas Dec 10, 2018
a92bff3
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 10, 2018
0b3fcd6
Merge remote-tracking branch 'origin/master' into deprecate-security-…
jkakavas Dec 10, 2018
32c97cb
Deprecate _xpack/security/role rest endpoint
jkakavas Dec 11, 2018
2049817
Fix SecurityRequestConvertersTests
jkakavas Dec 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private SecurityRequestConverters() {}

static Request changePassword(ChangePasswordRequest changePasswordRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/user")
.addPathPartAsIs("_security/user")
.addPathPart(changePasswordRequest.getUsername())
.addPathPartAsIs("_password")
.build();
Expand All @@ -67,7 +67,7 @@ static Request changePassword(ChangePasswordRequest changePasswordRequest) throw

static Request putUser(PutUserRequest putUserRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/user")
.addPathPartAsIs("_security/user")
.addPathPart(putUserRequest.getUser().getUsername())
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
Expand All @@ -79,7 +79,7 @@ static Request putUser(PutUserRequest putUserRequest) throws IOException {

static Request deleteUser(DeleteUserRequest deleteUserRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack","security", "user")
.addPathPartAsIs("_security", "user")
.addPathPart(deleteUserRequest.getName())
.build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand All @@ -90,7 +90,7 @@ static Request deleteUser(DeleteUserRequest deleteUserRequest) {

static Request putRoleMapping(final PutRoleMappingRequest putRoleMappingRequest) throws IOException {
final String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/role_mapping")
.addPathPartAsIs("_security/role_mapping")
.addPathPart(putRoleMappingRequest.getName())
.build();
final Request request = new Request(HttpPut.METHOD_NAME, endpoint);
Expand All @@ -102,7 +102,7 @@ static Request putRoleMapping(final PutRoleMappingRequest putRoleMappingRequest)

static Request getRoleMappings(final GetRoleMappingsRequest getRoleMappingRequest) throws IOException {
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder();
builder.addPathPartAsIs("_xpack/security/role_mapping");
builder.addPathPartAsIs("_security/role_mapping");
if (getRoleMappingRequest.getRoleMappingNames().size() > 0) {
builder.addPathPart(Strings.collectionToCommaDelimitedString(getRoleMappingRequest.getRoleMappingNames()));
}
Expand All @@ -119,7 +119,7 @@ static Request disableUser(DisableUserRequest disableUserRequest) {

private static Request setUserEnabled(SetUserEnabledRequest setUserEnabledRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/user")
.addPathPartAsIs("_security/user")
.addPathPart(setUserEnabledRequest.getUsername())
.addPathPart(setUserEnabledRequest.isEnabled() ? "_enable" : "_disable")
.build();
Expand All @@ -130,14 +130,14 @@ private static Request setUserEnabled(SetUserEnabledRequest setUserEnabledReques
}

static Request hasPrivileges(HasPrivilegesRequest hasPrivilegesRequest) throws IOException {
Request request = new Request(HttpGet.METHOD_NAME, "/_xpack/security/user/_has_privileges");
Request request = new Request(HttpGet.METHOD_NAME, "/_security/user/_has_privileges");
request.setEntity(createEntity(hasPrivilegesRequest, REQUEST_BODY_CONTENT_TYPE));
return request;
}

static Request clearRealmCache(ClearRealmCacheRequest clearRealmCacheRequest) {
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/realm");
.addPathPartAsIs("_security/realm");
if (clearRealmCacheRequest.getRealms().isEmpty() == false) {
builder.addCommaSeparatedPathParts(clearRealmCacheRequest.getRealms().toArray(Strings.EMPTY_ARRAY));
} else {
Expand All @@ -154,7 +154,7 @@ static Request clearRealmCache(ClearRealmCacheRequest clearRealmCacheRequest) {

static Request clearRolesCache(ClearRolesCacheRequest disableCacheRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/role")
.addPathPartAsIs("_security/role")
.addCommaSeparatedPathParts(disableCacheRequest.names())
.addPathPart("_clear_cache")
.build();
Expand All @@ -163,7 +163,7 @@ static Request clearRolesCache(ClearRolesCacheRequest disableCacheRequest) {

static Request deleteRoleMapping(DeleteRoleMappingRequest deleteRoleMappingRequest) {
final String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/role_mapping")
.addPathPartAsIs("_security/role_mapping")
.addPathPart(deleteRoleMappingRequest.getName())
.build();
final Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand All @@ -174,7 +174,7 @@ static Request deleteRoleMapping(DeleteRoleMappingRequest deleteRoleMappingReque

static Request deleteRole(DeleteRoleRequest deleteRoleRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/role")
.addPathPartAsIs("_security/role")
.addPathPart(deleteRoleRequest.getName())
.build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand All @@ -185,28 +185,28 @@ static Request deleteRole(DeleteRoleRequest deleteRoleRequest) {

static Request getRoles(GetRolesRequest getRolesRequest) {
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder();
builder.addPathPartAsIs("_xpack/security/role");
builder.addPathPartAsIs("_security/role");
if (getRolesRequest.getRoleNames().size() > 0) {
builder.addPathPart(Strings.collectionToCommaDelimitedString(getRolesRequest.getRoleNames()));
}
return new Request(HttpGet.METHOD_NAME, builder.build());
}

static Request createToken(CreateTokenRequest createTokenRequest) throws IOException {
Request request = new Request(HttpPost.METHOD_NAME, "/_xpack/security/oauth2/token");
Request request = new Request(HttpPost.METHOD_NAME, "/_security/oauth2/token");
request.setEntity(createEntity(createTokenRequest, REQUEST_BODY_CONTENT_TYPE));
return request;
}

static Request invalidateToken(InvalidateTokenRequest invalidateTokenRequest) throws IOException {
Request request = new Request(HttpDelete.METHOD_NAME, "/_xpack/security/oauth2/token");
Request request = new Request(HttpDelete.METHOD_NAME, "/_security/oauth2/token");
request.setEntity(createEntity(invalidateTokenRequest, REQUEST_BODY_CONTENT_TYPE));
return request;
}

static Request getPrivileges(GetPrivilegesRequest getPrivilegesRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/privilege")
.addPathPartAsIs("_security/privilege")
.addPathPart(getPrivilegesRequest.getApplicationName())
.addCommaSeparatedPathParts(getPrivilegesRequest.getPrivilegeNames())
.build();
Expand All @@ -215,7 +215,7 @@ static Request getPrivileges(GetPrivilegesRequest getPrivilegesRequest) {

static Request deletePrivileges(DeletePrivilegesRequest deletePrivilegeRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack/security/privilege")
.addPathPartAsIs("_security/privilege")
.addPathPart(deletePrivilegeRequest.getApplication())
.addCommaSeparatedPathParts(deletePrivilegeRequest.getPrivileges())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private AuthenticateRequest() {
}

public Request getRequest() {
return new Request(HttpGet.METHOD_NAME, "/_xpack/security/_authenticate");
return new Request(HttpGet.METHOD_NAME, "/_security/_authenticate");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testPutUser() throws Exception {
assertThat(updateUserResponse.isCreated(), is(false));
// delete user
final Request deleteUserRequest = new Request(HttpDelete.METHOD_NAME,
"/_xpack/security/user/" + putUserRequest.getUser().getUsername());
"/_security/user/" + putUserRequest.getUser().getUsername());
highLevelClient().getLowLevelClient().performRequest(deleteUserRequest);
}

Expand Down
Loading