7777
7878import static java .nio .charset .StandardCharsets .UTF_8 ;
7979import static org .hamcrest .Matchers .containsString ;
80- import static org .hamcrest .Matchers .equalTo ;
8180import static org .hamcrest .Matchers .startsWith ;
8281import static org .springframework .security .samples .OpenSamlActionTestingSupport .buildConditions ;
8382import static org .springframework .security .samples .OpenSamlActionTestingSupport .buildIssuer ;
@@ -237,8 +236,8 @@ public void authenticateWhenSignatureKeysDontMatchThenItFails() throws Exception
237236 sendResponse (response , "/login?error" )
238237 .andExpect (
239238 saml2AuthenticationExceptionMatcher (
240- "invalid_signature " ,
241- equalTo ( "Assertion doesn't have a valid signature. " )
239+ "invalid_assertion " ,
240+ containsString ( "Invalid assertion [assertion] for SAML response " )
242241 )
243242 );
244243 }
@@ -253,7 +252,7 @@ public void authenticateWhenNotOnOrAfterDontMatchThenItFails() throws Exception
253252 .andExpect (
254253 saml2AuthenticationExceptionMatcher (
255254 "invalid_assertion" ,
256- containsString ("Assertion ' assertion' with NotOnOrAfter condition of " )
255+ containsString ("Invalid assertion [assertion] for SAML response " )
257256 )
258257 );
259258 }
@@ -268,7 +267,7 @@ public void authenticateWhenNotOnOrBeforeDontMatchThenItFails() throws Exception
268267 .andExpect (
269268 saml2AuthenticationExceptionMatcher (
270269 "invalid_assertion" ,
271- containsString ("Assertion ' assertion' with NotBefore condition of " )
270+ containsString ("Invalid assertion [assertion] for SAML response " )
272271 )
273272 );
274273 }
@@ -285,8 +284,7 @@ public void authenticateWhenIssuerIsInvalidThenItFails() throws Exception {
285284 saml2AuthenticationExceptionMatcher (
286285 "invalid_issuer" ,
287286 containsString (
288- "Response issuer 'invalid issuer' doesn't match " +
289- "'https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php'"
287+ "Invalid issuer [invalid issuer] for SAML response"
290288 )
291289 )
292290 );
0 commit comments