@@ -61,7 +61,6 @@ public class Saml2AuthenticationTokenConverterTests {
6161 public void convertWhenSamlResponseThenToken () {
6262 Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (
6363 this .relyingPartyRegistrationResolver );
64- converter .setShouldInflateResponse (false );
6564 given (this .relyingPartyRegistrationResolver .resolve (any (HttpServletRequest .class ), any ()))
6665 .willReturn (this .relyingPartyRegistration );
6766 MockHttpServletRequest request = new MockHttpServletRequest ();
@@ -77,7 +76,6 @@ public void convertWhenSamlResponseThenToken() {
7776 public void convertWhenSamlResponseWithRelyingPartyRegistrationResolver (
7877 @ Mock RelyingPartyRegistrationResolver resolver ) {
7978 Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (resolver );
80- converter .setShouldInflateResponse (false );
8179 given (resolver .resolve (any (HttpServletRequest .class ), any ())).willReturn (this .relyingPartyRegistration );
8280 MockHttpServletRequest request = new MockHttpServletRequest ();
8381 request .setParameter (Saml2ParameterNames .SAML_RESPONSE ,
@@ -163,7 +161,6 @@ public void convertWhenGetRequestInvalidDeflatedThenSaml2AuthenticationException
163161 public void convertWhenUsingSamlUtilsBase64ThenXmlIsValid () throws Exception {
164162 Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (
165163 this .relyingPartyRegistrationResolver );
166- converter .setShouldInflateResponse (false );
167164 given (this .relyingPartyRegistrationResolver .resolve (any (HttpServletRequest .class ), any ()))
168165 .willReturn (this .relyingPartyRegistration );
169166 MockHttpServletRequest request = new MockHttpServletRequest ();
@@ -181,7 +178,6 @@ public void convertWhenSavedAuthenticationRequestThenToken() {
181178 .willReturn (this .relyingPartyRegistration .getRegistrationId ());
182179 Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (
183180 this .relyingPartyRegistrationResolver );
184- converter .setShouldInflateResponse (false );
185181 converter .setAuthenticationRequestRepository (authenticationRequestRepository );
186182 given (this .relyingPartyRegistrationResolver .resolve (any (HttpServletRequest .class ), any ()))
187183 .willReturn (this .relyingPartyRegistration );
@@ -207,7 +203,6 @@ public void convertWhenSavedAuthenticationRequestThenTokenWithRelyingPartyRegist
207203 .willReturn (this .relyingPartyRegistration .getRegistrationId ());
208204 Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (resolver );
209205 converter .setAuthenticationRequestRepository (authenticationRequestRepository );
210- converter .setShouldInflateResponse (false );
211206 given (resolver .resolve (any (HttpServletRequest .class ), any ())).willReturn (this .relyingPartyRegistration );
212207 given (authenticationRequestRepository .loadAuthenticationRequest (any (HttpServletRequest .class )))
213208 .willReturn (authenticationRequest );
@@ -235,6 +230,22 @@ public void setAuthenticationRequestRepositoryWhenNullThenIllegalArgument() {
235230 .isThrownBy (() -> converter .setAuthenticationRequestRepository (null ));
236231 }
237232
233+ @ Test
234+ public void convertWhenGetRequestWithoutInflate () {
235+ Saml2AuthenticationTokenConverter converter = new Saml2AuthenticationTokenConverter (
236+ this .relyingPartyRegistrationResolver );
237+ converter .setShouldInflateResponse (false );
238+ given (this .relyingPartyRegistrationResolver .resolve (any (HttpServletRequest .class ), any ()))
239+ .willReturn (this .relyingPartyRegistration );
240+ MockHttpServletRequest request = new MockHttpServletRequest ();
241+ request .setMethod ("GET" );
242+ request .setParameter (Saml2ParameterNames .SAML_RESPONSE , Saml2Utils .samlEncode ("response" .getBytes (StandardCharsets .UTF_8 )));
243+ Saml2AuthenticationToken token = converter .convert (request );
244+ assertThat (token .getSaml2Response ()).isEqualTo ("response" );
245+ assertThat (token .getRelyingPartyRegistration ().getRegistrationId ())
246+ .isEqualTo (this .relyingPartyRegistration .getRegistrationId ());
247+ }
248+
238249 private void validateSsoCircleXml (String xml ) {
239250 assertThat (xml ).contains ("InResponseTo=\" ARQ9a73ead-7dcf-45a8-89eb-26f3c9900c36\" " )
240251 .contains (" ID=\" s246d157446618e90e43fb79bdd4d9e9e19cf2c7c4\" " )
0 commit comments