Skip to content

Commit

Permalink
Remove hyphen from asserting-party
Browse files Browse the repository at this point in the history
spring.security.saml2.relyingparty.registration.*.asserting-party.* is
now named spring.security.saml2.relyingparty.registration.*.assertingparty.*

Closes gh-30785
  • Loading branch information
mhalbritter committed Apr 25, 2022
1 parent 3c5cea4 commit b406971
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
Expand Up @@ -136,10 +136,10 @@ void backOffIfOAuth2ResourceServerAutoConfigurationPresent() {
void backOffIfSaml2RelyingPartyAutoConfigurationPresent() {
this.contextRunner.withConfiguration(AutoConfigurations.of(Saml2RelyingPartyAutoConfiguration.class))
.withPropertyValues(
"spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.single-sign-on.url=https://simplesaml-for-spring-saml/SSOService.php",
"spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.single-sign-on.sign-request=false",
"spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
"spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.verification.credentials[0].certificate-location=classpath:saml/certificate-location")
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.url=https://simplesaml-for-spring-saml/SSOService.php",
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.sign-request=false",
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.verification.credentials[0].certificate-location=classpath:saml/certificate-location")
.run((context) -> assertThat(context).doesNotHaveBean(ManagementWebSecurityAutoConfiguration.class)
.doesNotHaveBean(MANAGEMENT_SECURITY_FILTER_CHAIN_BEAN));
}
Expand Down
Expand Up @@ -68,11 +68,11 @@ public static class Registration {
/**
* Remote SAML Identity Provider.
*/
private final AssertingParty assertingParty = new AssertingParty();
private final AssertingParty assertingparty = new AssertingParty();

/**
* Remote SAML Identity Provider.
* @deprecated use {@link #assertingParty}
* @deprecated use {@link #assertingparty}
*/
@Deprecated
private final AssertingParty identityprovider = new AssertingParty();
Expand All @@ -97,14 +97,14 @@ public Decryption getDecryption() {
return this.decryption;
}

public AssertingParty getAssertingParty() {
return this.assertingParty;
public AssertingParty getAssertingparty() {
return this.assertingparty;
}

/**
* Remote SAML Identity Provider.
* @return remote SAML Identity Provider
* @deprecated use {@link #getAssertingParty()}
* @deprecated use {@link #getAssertingparty()}
*/
@Deprecated
public AssertingParty getIdentityprovider() {
Expand Down
Expand Up @@ -203,15 +203,15 @@ Boolean getSingleSignonSignRequest() {

@SuppressWarnings("deprecation")
private <T> T get(String name, Function<AssertingParty, T> getter) {
T newValue = getter.apply(this.registration.getAssertingParty());
T newValue = getter.apply(this.registration.getAssertingparty());
if (newValue != null) {
return newValue;
}
T deprecatedValue = getter.apply(this.registration.getIdentityprovider());
if (deprecatedValue != null) {
logger.warn(LogMessage.format(
"Property 'spring.security.saml2.relyingparty.registration.identityprovider.%1$s.%2$s' is deprecated, "
+ "please use 'spring.security.saml2.relyingparty.registration.asserting-party.%1$s.%2$s' instead",
+ "please use 'spring.security.saml2.relyingparty.registration.assertingparty.%1$s.%2$s' instead",
this.id, name));
return deprecatedValue;
}
Expand Down
Expand Up @@ -186,7 +186,7 @@ void autoconfigurationShouldQueryAssertingPartyMetadataWhenMetadataUrlIsPresent(
server.start();
String metadataUrl = server.url("").toString();
setupMockResponse(server, new ClassPathResource("saml/idp-metadata"));
this.contextRunner.withPropertyValues(PREFIX + ".foo.asserting-party.metadata-uri=" + metadataUrl)
this.contextRunner.withPropertyValues(PREFIX + ".foo.assertingparty.metadata-uri=" + metadataUrl)
.run((context) -> {
assertThat(context).hasSingleBean(RelyingPartyRegistrationRepository.class);
assertThat(server.getRequestCount()).isEqualTo(1);
Expand Down Expand Up @@ -215,7 +215,7 @@ void autoconfigurationShouldUseBindingFromMetadataUrlIfPresent() throws Exceptio
server.start();
String metadataUrl = server.url("").toString();
setupMockResponse(server, new ClassPathResource("saml/idp-metadata"));
this.contextRunner.withPropertyValues(PREFIX + ".foo.asserting-party.metadata-uri=" + metadataUrl)
this.contextRunner.withPropertyValues(PREFIX + ".foo.assertingparty.metadata-uri=" + metadataUrl)
.run((context) -> {
RelyingPartyRegistrationRepository repository = context
.getBean(RelyingPartyRegistrationRepository.class);
Expand Down Expand Up @@ -250,8 +250,8 @@ void autoconfigurationWhenMetadataUrlAndPropertyPresentShouldUseBindingFromPrope
server.start();
String metadataUrl = server.url("").toString();
setupMockResponse(server, new ClassPathResource("saml/idp-metadata"));
this.contextRunner.withPropertyValues(PREFIX + ".foo.asserting-party.metadata-uri=" + metadataUrl,
PREFIX + ".foo.asserting-party.singlesignon.binding=redirect").run((context) -> {
this.contextRunner.withPropertyValues(PREFIX + ".foo.assertingparty.metadata-uri=" + metadataUrl,
PREFIX + ".foo.assertingparty.singlesignon.binding=redirect").run((context) -> {
RelyingPartyRegistrationRepository repository = context
.getBean(RelyingPartyRegistrationRepository.class);
RelyingPartyRegistration registration = repository.findByRegistrationId("foo");
Expand Down Expand Up @@ -378,7 +378,7 @@ void samlLoginShouldShouldBeConditionalOnSecurityWebFilterClassDeprecated() {
}

private String[] getPropertyValuesWithoutSigningCredentials(boolean signRequests, boolean useDeprecated) {
String assertingParty = useDeprecated ? "identityprovider" : "asserting-party";
String assertingParty = useDeprecated ? "identityprovider" : "assertingparty";
return new String[] {
PREFIX + ".foo." + assertingParty
+ ".singlesignon.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
Expand All @@ -391,7 +391,7 @@ private String[] getPropertyValuesWithoutSigningCredentials(boolean signRequests
}

private String[] getPropertyValuesWithoutSsoBinding(boolean useDeprecated) {
String assertingParty = useDeprecated ? "identityprovider" : "asserting-party";
String assertingParty = useDeprecated ? "identityprovider" : "assertingparty";
return new String[] {
PREFIX + ".foo." + assertingParty
+ ".singlesignon.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
Expand All @@ -403,7 +403,7 @@ private String[] getPropertyValuesWithoutSsoBinding(boolean useDeprecated) {
}

private String[] getPropertyValues(boolean useDeprecated) {
String assertingParty = useDeprecated ? "identityprovider" : "asserting-party";
String assertingParty = useDeprecated ? "identityprovider" : "assertingparty";
return new String[] {
PREFIX + ".foo.signing.credentials[0].private-key-location=classpath:saml/private-key-location",
PREFIX + ".foo.signing.credentials[0].certificate-location=classpath:saml/certificate-location",
Expand Down
Expand Up @@ -41,26 +41,26 @@ class Saml2RelyingPartyPropertiesTests {

@Test
void customizeSsoUrl() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.single-sign-on.url",
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.url",
"https://simplesaml-for-spring-saml/SSOService.php");
assertThat(
this.properties.getRegistration().get("simplesamlphp").getAssertingParty().getSinglesignon().getUrl())
this.properties.getRegistration().get("simplesamlphp").getAssertingparty().getSinglesignon().getUrl())
.isEqualTo("https://simplesaml-for-spring-saml/SSOService.php");
}

@Test
void customizeSsoBinding() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.single-sign-on.binding",
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.binding",
"post");
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingParty().getSinglesignon()
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingparty().getSinglesignon()
.getBinding()).isEqualTo(Saml2MessageBinding.POST);
}

@Test
void customizeSsoSignRequests() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.single-sign-on.sign-request",
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.sign-request",
"false");
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingParty().getSinglesignon()
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingparty().getSinglesignon()
.getSignRequest()).isEqualTo(false);
}

Expand All @@ -80,9 +80,9 @@ void customizeRelyingPartyEntityIdDefaultsToServiceProviderMetadata() {

@Test
void customizeAssertingPartyMetadataUri() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.asserting-party.metadata-uri",
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.metadata-uri",
"https://idp.example.org/metadata");
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingParty().getMetadataUri())
assertThat(this.properties.getRegistration().get("simplesamlphp").getAssertingparty().getMetadataUri())
.isEqualTo("https://idp.example.org/metadata");
}

Expand Down
Expand Up @@ -262,7 +262,7 @@ You can register multiple relying parties under the `spring.security.saml2.relyi
credentials:
- private-key-location: "path-to-private-key"
certificate-location: "path-to-certificate"
asserting-party:
assertingparty:
verification:
credentials:
- certificate-location: "path-to-verification-cert"
Expand All @@ -278,7 +278,7 @@ You can register multiple relying parties under the `spring.security.saml2.relyi
credentials:
- private-key-location: "path-to-private-key"
certificate-location: "path-to-certificate"
asserting-party:
assertingparty:
verification:
credentials:
- certificate-location: "path-to-other-verification-cert"
Expand Down
Expand Up @@ -8,7 +8,7 @@ spring:
credentials:
- private-key-location: "classpath:saml/privatekey.txt"
certificate-location: "classpath:saml/certificate.txt"
asserting-party:
assertingparty:
verification:
credentials:
- certificate-location: "classpath:saml/certificate.txt"
Expand All @@ -21,7 +21,7 @@ spring:
credentials:
- private-key-location: "classpath:saml/privatekey.txt"
certificate-location: "classpath:saml/certificate.txt"
asserting-party:
assertingparty:
verification:
credentials:
- certificate-location: "classpath:saml/certificate.txt"
Expand Down

0 comments on commit b406971

Please sign in to comment.