Skip to content

Commit ac2acc6

Browse files
committed
Merge pull request #39395 from BenchmarkingBuffalo
* pr/39395: Add nameIdFormat to Properties Closes gh-39395
2 parents 9a5b3b3 + 8e75817 commit ac2acc6

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @author Madhura Bhave
3232
* @author Phillip Webb
3333
* @author Moritz Halbritter
34+
* @author Lasse Wulff
3435
* @since 2.2.0
3536
*/
3637
@ConfigurationProperties("spring.security.saml2.relyingparty")
@@ -72,6 +73,8 @@ public static class Registration {
7273
*/
7374
private final AssertingParty assertingparty = new AssertingParty();
7475

76+
private String nameIdFormat;
77+
7578
public String getEntityId() {
7679
return this.entityId;
7780
}
@@ -92,12 +95,20 @@ public Decryption getDecryption() {
9295
return this.decryption;
9396
}
9497

98+
public Singlelogout getSinglelogout() {
99+
return this.singlelogout;
100+
}
101+
95102
public AssertingParty getAssertingparty() {
96103
return this.assertingparty;
97104
}
98105

99-
public Singlelogout getSinglelogout() {
100-
return this.singlelogout;
106+
public String getNameIdFormat() {
107+
return this.nameIdFormat;
108+
}
109+
110+
public void setNameIdFormat(String nameIdFormat) {
111+
this.nameIdFormat = nameIdFormat;
101112
}
102113

103114
public static class Acs {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyRegistrationConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* @author Phillip Webb
5757
* @author Moritz Halbritter
5858
* @author Lasse Lindqvist
59+
* @author Lasse Wulff
5960
*/
6061
@Configuration(proxyBeanMethods = false)
6162
@Conditional(RegistrationConfiguredCondition.class)
@@ -104,6 +105,7 @@ private RelyingPartyRegistration asRegistration(String id, Registration properti
104105
builder.singleLogoutServiceResponseLocation(properties.getSinglelogout().getResponseUrl());
105106
builder.singleLogoutServiceBinding(properties.getSinglelogout().getBinding());
106107
builder.entityId(properties.getEntityId());
108+
builder.nameIdFormat(properties.getNameIdFormat());
107109
RelyingPartyRegistration registration = builder.build();
108110
boolean signRequest = registration.getAssertingPartyDetails().getWantAuthnRequestsSigned();
109111
validateSigningCredentials(properties, signRequest);

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* Tests for {@link Saml2RelyingPartyProperties}.
3535
*
3636
* @author Madhura Bhave
37+
* @author Lasse Wulff
3738
*/
3839
class Saml2RelyingPartyPropertiesTests {
3940

@@ -102,6 +103,13 @@ void customizeSsoSignRequestsIsNullByDefault() {
102103
.getSignRequest()).isNull();
103104
}
104105

106+
@Test
107+
void customizeNameIdFormat() {
108+
bind("spring.security.saml2.relyingparty.registration.simplesamlphp.name-id-format", "sampleNameIdFormat");
109+
assertThat(this.properties.getRegistration().get("simplesamlphp").getNameIdFormat())
110+
.isEqualTo("sampleNameIdFormat");
111+
}
112+
105113
private void bind(String name, String value) {
106114
bind(Collections.singletonMap(name, value));
107115
}

0 commit comments

Comments
 (0)