Skip to content

Commit 7b3122d

Browse files
committed
Polish SAML 2.0 Authentication Builder
Issue gh-17861
1 parent 043f6da commit 7b3122d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2AssertionAuthentication.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.springframework.security.core.Authentication;
2525
import org.springframework.security.core.GrantedAuthority;
26+
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
2627
import org.springframework.util.Assert;
2728

2829
/**
@@ -78,8 +79,7 @@ public Builder<?> toBuilder() {
7879
}
7980

8081
/**
81-
* A builder preserving the concrete {@link Authentication} type
82-
*
82+
* A builder of {@link Saml2AssertionAuthentication} instances
8383
* @since 7.0
8484
*/
8585
public static class Builder<B extends Builder<B>> extends Saml2Authentication.Builder<B> {
@@ -94,6 +94,12 @@ protected Builder(Saml2AssertionAuthentication token) {
9494
this.relyingPartyRegistrationId = token.relyingPartyRegistrationId;
9595
}
9696

97+
/**
98+
* Use these credentials.
99+
* They must be of type {@link Saml2ResponseAssertionAccessor}.
100+
* @param credentials the credentials to use
101+
* @return the {@link Builder} for further configurations
102+
*/
97103
@Override
98104
public B credentials(@Nullable Object credentials) {
99105
Assert.isInstanceOf(Saml2ResponseAssertionAccessor.class, credentials,
@@ -103,6 +109,12 @@ public B credentials(@Nullable Object credentials) {
103109
return (B) this;
104110
}
105111

112+
/**
113+
* Use this registration id
114+
* @param relyingPartyRegistrationId the {@link RelyingPartyRegistration#getRegistrationId}
115+
* to use
116+
* @return the {@link Builder} for further configurations
117+
*/
106118
public B relyingPartyRegistrationId(String relyingPartyRegistrationId) {
107119
this.relyingPartyRegistrationId = relyingPartyRegistrationId;
108120
return (B) this;

0 commit comments

Comments
 (0)