Rename `singleSignOn` property to `singlesignon`

Rename the SAML `singleSignOn` nested property to `singleSignOn` so
that we don't get problems when using uppercase environment variable
names.

See gh-20584
pull/20857/head
Phillip Webb 5 years ago
parent 3ca896e63f
commit ed2d90248c

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.core.io.Resource;
import org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding;
@ -120,12 +121,7 @@ public class Saml2RelyingPartyProperties {
*/
private String entityId;
/**
* Remote endpoint to send authentication requests to.
*/
private String ssoUrl;
private SingleSignOn singleSignOn = new SingleSignOn();
private Singlesignon singlesignon = new Singlesignon();
private Verification verification = new Verification();
@ -138,24 +134,28 @@ public class Saml2RelyingPartyProperties {
}
@Deprecated
@DeprecatedConfigurationProperty(reason = "moved to 'singlesignon.url'")
public String getSsoUrl() {
return this.getSingleSignOn().getUrl();
return this.singlesignon.getUrl();
}
@Deprecated
public void setSsoUrl(String ssoUrl) {
this.singleSignOn.setUrl(ssoUrl);
this.singlesignon.setUrl(ssoUrl);
}
public SingleSignOn getSingleSignOn() {
return this.singleSignOn;
public Singlesignon getSinglesignon() {
return this.singlesignon;
}
public Verification getVerification() {
return this.verification;
}
public static class SingleSignOn {
/**
* Single sign on details for an Identity Provider.
*/
public static class Singlesignon {
/**
* Remote endpoint to send authentication requests to.
@ -198,6 +198,9 @@ public class Saml2RelyingPartyProperties {
}
/**
* Verification details for an Identity Provider.
*/
public static class Verification {
/**

@ -66,16 +66,16 @@ class Saml2RelyingPartyRegistrationConfiguration {
}
private RelyingPartyRegistration asRegistration(String id, Registration properties) {
boolean signRequest = properties.getIdentityprovider().getSingleSignOn().isSignRequest();
boolean signRequest = properties.getIdentityprovider().getSinglesignon().isSignRequest();
validateSigningCredentials(properties, signRequest);
RelyingPartyRegistration.Builder builder = RelyingPartyRegistration.withRegistrationId(id);
builder.assertionConsumerServiceUrlTemplate(
"{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI);
builder.providerDetails(
(details) -> details.webSsoUrl(properties.getIdentityprovider().getSingleSignOn().getUrl()));
(details) -> details.webSsoUrl(properties.getIdentityprovider().getSinglesignon().getUrl()));
builder.providerDetails((details) -> details.entityId(properties.getIdentityprovider().getEntityId()));
builder.providerDetails(
(details) -> details.binding(properties.getIdentityprovider().getSingleSignOn().getBinding()));
(details) -> details.binding(properties.getIdentityprovider().getSinglesignon().getBinding()));
builder.providerDetails((details) -> details.signAuthNRequest(signRequest));
builder.credentials((credentials) -> credentials.addAll(asCredentials(properties)));
return builder.build();

@ -132,9 +132,9 @@ public class Saml2RelyingPartyAutoConfigurationTests {
private String[] getPropertyValuesWithoutSigningCredentials(boolean signRequests) {
return new String[] { PREFIX
+ ".foo.identityprovider.single-sign-on.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
PREFIX + ".foo.identityprovider.single-sign-on.binding=post",
PREFIX + ".foo.identityprovider.single-sign-on.sign-request=" + signRequests,
+ ".foo.identityprovider.singlesignon.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
PREFIX + ".foo.identityprovider.singlesignon.binding=post",
PREFIX + ".foo.identityprovider.singlesignon.sign-request=" + signRequests,
PREFIX + ".foo.identityprovider.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
PREFIX + ".foo.identityprovider.verification.credentials[0].certificate-location=classpath:saml/certificate-location" };
}
@ -143,9 +143,9 @@ public class Saml2RelyingPartyAutoConfigurationTests {
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",
PREFIX + ".foo.identityprovider.single-sign-on.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
PREFIX + ".foo.identityprovider.single-sign-on.binding=post",
PREFIX + ".foo.identityprovider.single-sign-on.sign-request=false",
PREFIX + ".foo.identityprovider.singlesignon.url=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
PREFIX + ".foo.identityprovider.singlesignon.binding=post",
PREFIX + ".foo.identityprovider.singlesignon.sign-request=false",
PREFIX + ".foo.identityprovider.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
PREFIX + ".foo.identityprovider.verification.credentials[0].certificate-location=classpath:saml/certificate-location" };
}

@ -44,7 +44,7 @@ class Saml2RelyingPartyPropertiesTests {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.url",
"https://simplesaml-for-spring-saml/SSOService.php");
assertThat(
this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn().getUrl())
this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon().getUrl())
.isEqualTo("https://simplesaml-for-spring-saml/SSOService.php");
}
@ -53,14 +53,14 @@ class Saml2RelyingPartyPropertiesTests {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.url",
"https://simplesaml-for-spring-saml/SSOService.php");
assertThat(
this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn().getUrl())
this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon().getUrl())
.isEqualTo("https://simplesaml-for-spring-saml/SSOService.php");
}
@Test
void customizeSsoBindingDefaultsToRedirect() {
this.properties.getRegistration().put("simplesamlphp", new Saml2RelyingPartyProperties.Registration());
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn()
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon()
.getBinding()).isEqualTo(Saml2MessageBinding.REDIRECT);
}
@ -68,7 +68,7 @@ class Saml2RelyingPartyPropertiesTests {
void customizeSsoBinding() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.binding",
"post");
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn()
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon()
.getBinding()).isEqualTo(Saml2MessageBinding.POST);
}
@ -76,14 +76,14 @@ class Saml2RelyingPartyPropertiesTests {
void customizeSsoSignRequests() {
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.sign-request",
"false");
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn()
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon()
.isSignRequest()).isEqualTo(false);
}
@Test
void customizeSsoSignRequestsIsTrueByDefault() {
this.properties.getRegistration().put("simplesamlphp", new Saml2RelyingPartyProperties.Registration());
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSingleSignOn()
assertThat(this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon()
.isSignRequest()).isEqualTo(true);
}

@ -13,7 +13,7 @@ spring:
credentials:
- certificate-location: "classpath:saml/certificate.txt"
entity-id: simplesaml
single-sign-on:
singlesignon:
url: https://simplesaml-for-spring-saml/SSOService.php
okta:
signing:
@ -25,6 +25,6 @@ spring:
credentials:
- certificate-location: "classpath:saml/certificate.txt"
entity-id: okta-id-1234
single-sign-on:
singlesignon:
url:
https://okta-for-spring/saml2/idp/SSOService.php

Loading…
Cancel
Save