Skip to content

Commit

Permalink
Merge branch '2.2.x' into 2.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejwalkowiak committed Jun 19, 2020
2 parents 849151b + 0cbbd39 commit 1f53dc9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docs/src/main/asciidoc/spring-cloud-aws.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ You can configure the following settings in a Spring Cloud `bootstrap.properties

|`aws.paramstore.profileSeparator`
|`_`
|String that separates an appended profile from the context name. Note that an AWS parameter key can only contain
dots, dashes and underscores next to alphanumeric characters.
|String that separates an appended profile from the context name. Can only contain
dots, dashes, forward slashes, backward slashes and underscores next to alphanumeric characters.

|`aws.paramstore.failFast`
|`true`
Expand Down Expand Up @@ -768,7 +768,8 @@ You can configure the following settings in a Spring Cloud `bootstrap.properties

|`aws.secretsmanager.profileSeparator`
|`_`
|String that separates an appended profile from the context name.
|String that separates an appended profile from the context name. Can only contain
dots, dashes, forward slashes, backward slashes and underscores next to alphanumeric characters.

|`aws.secretsmanager.failFast`
|`true`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AwsParamStoreProperties implements Validator {
* Pattern used for profileSeparator validation.
*/
private static final Pattern PROFILE_SEPARATOR_PATTERN = Pattern
.compile("[a-zA-Z0-9.\\-_/]+");
.compile("[a-zA-Z0-9.\\-_/\\\\]+");

/**
* Prefix indicating first level for every property. Value must start with a forward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@ void validationSucceeds() {
assertThat(errors.getAllErrors()).isEmpty();
}

@Test
void acceptsForwardSlashAsProfileSeparator() {
AwsParamStoreProperties properties = new AwsParamStoreProperties();
properties.setProfileSeparator("/");

Errors errors = new BeanPropertyBindingResult(properties, "properties");

properties.validate(properties, errors);

assertThat(errors.getFieldError("profileSeparator")).isNull();
}

@Test
void acceptsBackslashAsProfileSeparator() {
AwsParamStoreProperties properties = new AwsParamStoreProperties();
properties.setProfileSeparator("\\");

Errors errors = new BeanPropertyBindingResult(properties, "properties");

properties.validate(properties, errors);

assertThat(errors.getFieldError("profileSeparator")).isNull();
}

private static Stream<Arguments> invalidProperties() {
return Stream.of(
Arguments.of(new AwsParamStorePropertiesBuilder().withPrefix("").build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AwsSecretsManagerProperties implements Validator {
* Pattern used for profileSeparator validation.
*/
private static final Pattern PROFILE_SEPARATOR_PATTERN = Pattern
.compile("[a-zA-Z0-9.\\-_]+");
.compile("[a-zA-Z0-9.\\-_/\\\\]+");

/**
* Prefix indicating first level for every property. Value must start with a forward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ public void validationFails(AwsSecretsManagerProperties properties, String field
assertThat(errors.getFieldError(field).getCode()).isEqualTo(errorCode);
}

@Test
void acceptsForwardSlashAsProfileSeparator() {
AwsSecretsManagerProperties properties = new AwsSecretsManagerProperties();
properties.setProfileSeparator("/");

Errors errors = new BeanPropertyBindingResult(properties, "properties");

properties.validate(properties, errors);

assertThat(errors.getFieldError("profileSeparator")).isNull();
}

@Test
void acceptsBackslashAsProfileSeparator() {
AwsSecretsManagerProperties properties = new AwsSecretsManagerProperties();
properties.setProfileSeparator("\\");

Errors errors = new BeanPropertyBindingResult(properties, "properties");

properties.validate(properties, errors);

assertThat(errors.getFieldError("profileSeparator")).isNull();
}

private static Stream<Arguments> invalidProperties() {
return Stream.of(
Arguments.of(
Expand Down

0 comments on commit 1f53dc9

Please sign in to comment.