shield: remove the ability to specify username in request body
This commit removes the parsing of the username in the request body of a put user request. Additionally, we use the name passed into the put role request builder rather than the name from the parsed role descriptor. Original commit: elastic/x-pack-elasticsearch@0a085d5844
This commit is contained in:
parent
0d1f3da353
commit
77e6622179
|
@ -26,7 +26,8 @@ public class PutRoleRequestBuilder extends ActionRequestBuilder<PutRoleRequest,
|
|||
|
||||
public PutRoleRequestBuilder source(String name, BytesReference source) throws Exception {
|
||||
RoleDescriptor descriptor = RoleDescriptor.parse(name, source);
|
||||
request.name(descriptor.getName());
|
||||
assert name.equals(descriptor.getName());
|
||||
request.name(name);
|
||||
request.cluster(descriptor.getClusterPrivileges());
|
||||
request.addIndex(descriptor.getIndicesPrivileges());
|
||||
request.runAs(descriptor.getRunAs());
|
||||
|
|
|
@ -91,11 +91,6 @@ public class PutUserRequestBuilder extends ActionRequestBuilder<PutUserRequest,
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, User.Fields.USERNAME)) {
|
||||
if (username.equals(parser.text()) == false) {
|
||||
throw new ElasticsearchParseException("failed to parse user [{}]. username doesn't match user id [{}]",
|
||||
username, parser.text());
|
||||
}
|
||||
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, User.Fields.PASSWORD)) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
String password = parser.text();
|
||||
|
|
Loading…
Reference in New Issue