diff --git a/auth/server/src/main/java/com/seagates3/parameter/validator/AccessKeyParameterValidator.java b/auth/server/src/main/java/com/seagates3/parameter/validator/AccessKeyParameterValidator.java index 2191c6a41..775ccfe8e 100644 --- a/auth/server/src/main/java/com/seagates3/parameter/validator/AccessKeyParameterValidator.java +++ b/auth/server/src/main/java/com/seagates3/parameter/validator/AccessKeyParameterValidator.java @@ -37,13 +37,10 @@ public class AccessKeyParameterValidator extends AbstractParameterValidator { @Override public Boolean isValidCreateParams(Map requestBody) { boolean isValid = true; - if (requestBody.containsKey("UserName")) { - isValid = - S3ParameterValidatorUtil.isValidName(requestBody.get("UserName")); - } else { - isValid = false; - } - + if (requestBody.containsKey("UserName")) { + isValid = + S3ParameterValidatorUtil.isValidName(requestBody.get("UserName")); + } if (isValid) { isValid = isAccessKeySecretKeyCombinationValid( requestBody.get("AccessKey"), requestBody.get("SecretKey")); diff --git a/auth/server/src/test/java/com/seagates3/parameter/validator/AccessKeyParameterValidatorTest.java b/auth/server/src/test/java/com/seagates3/parameter/validator/AccessKeyParameterValidatorTest.java index 5771d263d..39da330d3 100644 --- a/auth/server/src/test/java/com/seagates3/parameter/validator/AccessKeyParameterValidatorTest.java +++ b/auth/server/src/test/java/com/seagates3/parameter/validator/AccessKeyParameterValidatorTest.java @@ -47,7 +47,7 @@ public void setUp() { */ @Test public void Create_UserNameNull_True() { - assertFalse(accessKeyValidator.isValidCreateParams(requestBody)); + assertTrue(accessKeyValidator.isValidCreateParams(requestBody)); } /**