Skip to content

Add nameIdFormat to Properties #39395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* @author Madhura Bhave
* @author Phillip Webb
* @author Moritz Halbritter
* @author Lasse Wulff
* @since 2.2.0
*/
@ConfigurationProperties("spring.security.saml2.relyingparty")
Expand Down Expand Up @@ -72,6 +73,8 @@ public static class Registration {
*/
private final AssertingParty assertingparty = new AssertingParty();

private String nameIdFormat;

public String getEntityId() {
return this.entityId;
}
Expand All @@ -92,12 +95,20 @@ public Decryption getDecryption() {
return this.decryption;
}

public Singlelogout getSinglelogout() {
return this.singlelogout;
}

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

public Singlelogout getSinglelogout() {
return this.singlelogout;
public String getNameIdFormat() {
return this.nameIdFormat;
}

public void setNameIdFormat(String nameIdFormat) {
this.nameIdFormat = nameIdFormat;
}

public static class Acs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* @author Phillip Webb
* @author Moritz Halbritter
* @author Lasse Lindqvist
* @author Lasse Wulff
*/
@Configuration(proxyBeanMethods = false)
@Conditional(RegistrationConfiguredCondition.class)
Expand Down Expand Up @@ -104,6 +105,7 @@ private RelyingPartyRegistration asRegistration(String id, Registration properti
builder.singleLogoutServiceResponseLocation(properties.getSinglelogout().getResponseUrl());
builder.singleLogoutServiceBinding(properties.getSinglelogout().getBinding());
builder.entityId(properties.getEntityId());
builder.nameIdFormat(properties.getNameIdFormat());
RelyingPartyRegistration registration = builder.build();
boolean signRequest = registration.getAssertingPartyDetails().getWantAuthnRequestsSigned();
validateSigningCredentials(properties, signRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* Tests for {@link Saml2RelyingPartyProperties}.
*
* @author Madhura Bhave
* @author Lasse Wulff
*/
class Saml2RelyingPartyPropertiesTests {

Expand Down Expand Up @@ -102,6 +103,13 @@ void customizeSsoSignRequestsIsNullByDefault() {
.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) {
bind(Collections.singletonMap(name, value));
}
Expand Down