From 929e1791503840655d4941576a5d192efc60d4d3 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 24 Mar 2016 14:56:11 -0400 Subject: [PATCH] shield: put user should validate password length This changes the put user request builder to validate password length when a password is provided. The validation is the same as what we use in the file based realm. Closes elastic/elasticsearch#1800 Original commit: elastic/x-pack-elasticsearch@fde1d6c6856b5d90540aaaf7c845838f0d6deee7 --- .../shield/action/user/PutUserRequestBuilder.java | 14 +++++++++++++- .../shield/authc/esnative/ESNativeTests.java | 11 +++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/action/user/PutUserRequestBuilder.java b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/action/user/PutUserRequestBuilder.java index 0225329421d..d3d2fc74320 100644 --- a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/action/user/PutUserRequestBuilder.java +++ b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/action/user/PutUserRequestBuilder.java @@ -11,12 +11,14 @@ import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.shield.User; import org.elasticsearch.shield.authc.support.Hasher; import org.elasticsearch.shield.authc.support.SecuredString; +import org.elasticsearch.shield.support.Validation; import org.elasticsearch.xpack.common.xcontent.XContentUtils; import java.io.IOException; @@ -46,7 +48,17 @@ public class PutUserRequestBuilder extends ActionRequestBuilder