mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Add nameIdFormat to Properties
Add the new property nameIdFormat to the Saml2RelyingPartyProperties and the corresponding mapping to the Saml2RelyingPartyRegistrationConfiguration. See gh-39395
This commit is contained in:
parent
22de896339
commit
8e75817d6a
@ -31,6 +31,7 @@ import org.springframework.security.saml2.provider.service.registration.Saml2Mes
|
|||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
|
* @author Lasse Wulff
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties("spring.security.saml2.relyingparty")
|
@ConfigurationProperties("spring.security.saml2.relyingparty")
|
||||||
@ -72,6 +73,8 @@ public class Saml2RelyingPartyProperties {
|
|||||||
*/
|
*/
|
||||||
private final AssertingParty assertingparty = new AssertingParty();
|
private final AssertingParty assertingparty = new AssertingParty();
|
||||||
|
|
||||||
|
private String nameIdFormat;
|
||||||
|
|
||||||
public String getEntityId() {
|
public String getEntityId() {
|
||||||
return this.entityId;
|
return this.entityId;
|
||||||
}
|
}
|
||||||
@ -92,12 +95,20 @@ public class Saml2RelyingPartyProperties {
|
|||||||
return this.decryption;
|
return this.decryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Singlelogout getSinglelogout() {
|
||||||
|
return this.singlelogout;
|
||||||
|
}
|
||||||
|
|
||||||
public AssertingParty getAssertingparty() {
|
public AssertingParty getAssertingparty() {
|
||||||
return this.assertingparty;
|
return this.assertingparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Singlelogout getSinglelogout() {
|
public String getNameIdFormat() {
|
||||||
return this.singlelogout;
|
return this.nameIdFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameIdFormat(String nameIdFormat) {
|
||||||
|
this.nameIdFormat = nameIdFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Acs {
|
public static class Acs {
|
||||||
|
@ -56,6 +56,7 @@ import org.springframework.util.StringUtils;
|
|||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
* @author Lasse Lindqvist
|
* @author Lasse Lindqvist
|
||||||
|
* @author Lasse Wulff
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Conditional(RegistrationConfiguredCondition.class)
|
@Conditional(RegistrationConfiguredCondition.class)
|
||||||
@ -104,6 +105,7 @@ class Saml2RelyingPartyRegistrationConfiguration {
|
|||||||
builder.singleLogoutServiceResponseLocation(properties.getSinglelogout().getResponseUrl());
|
builder.singleLogoutServiceResponseLocation(properties.getSinglelogout().getResponseUrl());
|
||||||
builder.singleLogoutServiceBinding(properties.getSinglelogout().getBinding());
|
builder.singleLogoutServiceBinding(properties.getSinglelogout().getBinding());
|
||||||
builder.entityId(properties.getEntityId());
|
builder.entityId(properties.getEntityId());
|
||||||
|
builder.nameIdFormat(properties.getNameIdFormat());
|
||||||
RelyingPartyRegistration registration = builder.build();
|
RelyingPartyRegistration registration = builder.build();
|
||||||
boolean signRequest = registration.getAssertingPartyDetails().getWantAuthnRequestsSigned();
|
boolean signRequest = registration.getAssertingPartyDetails().getWantAuthnRequestsSigned();
|
||||||
validateSigningCredentials(properties, signRequest);
|
validateSigningCredentials(properties, signRequest);
|
||||||
|
@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* Tests for {@link Saml2RelyingPartyProperties}.
|
* Tests for {@link Saml2RelyingPartyProperties}.
|
||||||
*
|
*
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
|
* @author Lasse Wulff
|
||||||
*/
|
*/
|
||||||
class Saml2RelyingPartyPropertiesTests {
|
class Saml2RelyingPartyPropertiesTests {
|
||||||
|
|
||||||
@ -102,6 +103,13 @@ class Saml2RelyingPartyPropertiesTests {
|
|||||||
.getSignRequest()).isNull();
|
.getSignRequest()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void customizeNameIdFormat() {
|
||||||
|
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.name-id-format", "sampleNameIdFormat");
|
||||||
|
assertThat(this.properties.getRegistration().get("simplesamlphp").getNameIdFormat())
|
||||||
|
.isEqualTo("sampleNameIdFormat");
|
||||||
|
}
|
||||||
|
|
||||||
private void bind(String name, String value) {
|
private void bind(String name, String value) {
|
||||||
bind(Collections.singletonMap(name, value));
|
bind(Collections.singletonMap(name, value));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user