1616
1717package org .springframework .security .saml2 .provider .service .web .authentication ;
1818
19+ import java .util .stream .Stream ;
20+
1921import org .junit .jupiter .api .BeforeEach ;
2022import org .junit .jupiter .api .Test ;
2123import org .junit .jupiter .params .ParameterizedTest ;
3537import org .springframework .security .saml2 .provider .service .web .RelyingPartyRegistrationPlaceholderResolvers ;
3638import org .springframework .security .saml2 .provider .service .web .RelyingPartyRegistrationPlaceholderResolvers .UriResolver ;
3739
38- import java .util .stream .Stream ;
39-
4040import static org .assertj .core .api .Assertions .assertThat ;
4141import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
4242
@@ -54,13 +54,13 @@ public void setUp() {
5454
5555 @ ParameterizedTest
5656 @ MethodSource ("provideSignRequestFlags" )
57- public void resolveAuthenticationRequestWhenSignedRedirectThenSignsAndRedirects (boolean wantAuthRequestsSigned , boolean authnRequestsSigned ) {
57+ public void resolveAuthenticationRequestWhenSignedRedirectThenSignsAndRedirects (boolean wantAuthRequestsSigned ,
58+ boolean authnRequestsSigned ) {
5859 MockHttpServletRequest request = new MockHttpServletRequest ();
5960 request .setPathInfo ("/saml2/authenticate/registration-id" );
6061 RelyingPartyRegistration registration = this .relyingPartyRegistrationBuilder
6162 .authnRequestsSigned (authnRequestsSigned )
62- .assertingPartyDetails (party -> party .wantAuthnRequestsSigned (wantAuthRequestsSigned ))
63- .build ();
63+ .assertingPartyDetails ((party ) -> party .wantAuthnRequestsSigned (wantAuthRequestsSigned )).build ();
6464 OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver (registration );
6565 Saml2RedirectAuthenticationRequest result = resolver .resolve (request , (r , authnRequest ) -> {
6666 UriResolver uriResolver = RelyingPartyRegistrationPlaceholderResolvers .uriResolver (request , registration );
@@ -122,10 +122,9 @@ public void resolveAuthenticationRequestWhenSignedThenCredentialIsRequired() {
122122 public void resolveAuthenticationRequestWhenUnsignedPostThenOnlyPosts () {
123123 MockHttpServletRequest request = new MockHttpServletRequest ();
124124 request .setPathInfo ("/saml2/authenticate/registration-id" );
125- RelyingPartyRegistration registration = this .relyingPartyRegistrationBuilder
126- .assertingPartyDetails ((party ) -> party .singleSignOnServiceBinding (Saml2MessageBinding .POST ).wantAuthnRequestsSigned (false ))
127- .authnRequestsSigned (false )
128- .build ();
125+ RelyingPartyRegistration registration = this .relyingPartyRegistrationBuilder .assertingPartyDetails (
126+ (party ) -> party .singleSignOnServiceBinding (Saml2MessageBinding .POST ).wantAuthnRequestsSigned (false ))
127+ .authnRequestsSigned (false ).build ();
129128 OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver (registration );
130129 Saml2PostAuthenticationRequest result = resolver .resolve (request , (r , authnRequest ) -> {
131130 UriResolver uriResolver = RelyingPartyRegistrationPlaceholderResolvers .uriResolver (request , registration );
@@ -146,7 +145,8 @@ public void resolveAuthenticationRequestWhenUnsignedPostThenOnlyPosts() {
146145
147146 @ ParameterizedTest
148147 @ MethodSource ("provideSignRequestFlags" )
149- public void resolveAuthenticationRequestWhenSignedPostThenSignsAndPosts (boolean wantAuthRequestsSigned , boolean authnRequestsSigned ) {
148+ public void resolveAuthenticationRequestWhenSignedPostThenSignsAndPosts (boolean wantAuthRequestsSigned ,
149+ boolean authnRequestsSigned ) {
150150 MockHttpServletRequest request = new MockHttpServletRequest ();
151151 request .setPathInfo ("/saml2/authenticate/registration-id" );
152152 RelyingPartyRegistration registration = this .relyingPartyRegistrationBuilder
@@ -195,11 +195,7 @@ private OpenSamlAuthenticationRequestResolver authenticationRequestResolver(Rely
195195 }
196196
197197 private static Stream <Arguments > provideSignRequestFlags () {
198- return Stream .of (
199- Arguments .of (true , true ),
200- Arguments .of (true , false ),
201- Arguments .of (false , true )
202- );
198+ return Stream .of (Arguments .of (true , true ), Arguments .of (true , false ), Arguments .of (false , true ));
203199 }
204200
205201}
0 commit comments