Skip to content

Commit e7281a7

Browse files
committed
Polish SAML 2.0 Authentication Builder
Issue gh-17861
1 parent 69ee8d9 commit e7281a7

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
@@ -21,8 +21,8 @@
2121

2222
import org.jspecify.annotations.Nullable;
2323

24-
import org.springframework.security.core.Authentication;
2524
import org.springframework.security.core.GrantedAuthority;
25+
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
2626
import org.springframework.util.Assert;
2727

2828
/**
@@ -78,7 +78,7 @@ public Builder<?> toBuilder() {
7878
}
7979

8080
/**
81-
* A builder preserving the concrete {@link Authentication} type
81+
* A builder of {@link Saml2AssertionAuthentication} instances
8282
*
8383
* @since 7.0
8484
*/
@@ -94,6 +94,12 @@ protected Builder(Saml2AssertionAuthentication token) {
9494
this.relyingPartyRegistrationId = token.relyingPartyRegistrationId;
9595
}
9696

97+
/**
98+
* Use these credentials. They must be of type
99+
* {@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
115+
* {@link RelyingPartyRegistration#getRegistrationId} 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)