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 .matchesRegex ;
8281import static org .hamcrest .Matchers .startsWith ;
8382import static org .springframework .security .saml2 .provider .service .authentication .OpenSamlActionTestingSupport .buildConditions ;
@@ -242,8 +241,8 @@ public void authenticateWhenSignatureKeysDontMatchThenItFails() throws Exception
242241 sendResponse (response , "/login?error" )
243242 .andExpect (
244243 saml2AuthenticationExceptionMatcher (
245- "invalid_signature " ,
246- equalTo ( "Assertion doesn't have a valid signature. " )
244+ "invalid_assertion " ,
245+ containsString ( "Invalid assertion [assertion] for SAML response " )
247246 )
248247 );
249248 }
@@ -258,7 +257,7 @@ public void authenticateWhenNotOnOrAfterDontMatchThenItFails() throws Exception
258257 .andExpect (
259258 saml2AuthenticationExceptionMatcher (
260259 "invalid_assertion" ,
261- containsString ("Assertion ' assertion' with NotOnOrAfter condition of " )
260+ containsString ("Invalid assertion [assertion] for SAML response " )
262261 )
263262 );
264263 }
@@ -273,7 +272,7 @@ public void authenticateWhenNotOnOrBeforeDontMatchThenItFails() throws Exception
273272 .andExpect (
274273 saml2AuthenticationExceptionMatcher (
275274 "invalid_assertion" ,
276- containsString ("Assertion ' assertion' with NotBefore condition of " )
275+ containsString ("Invalid assertion [assertion] for SAML response " )
277276 )
278277 );
279278 }
@@ -290,8 +289,7 @@ public void authenticateWhenIssuerIsInvalidThenItFails() throws Exception {
290289 saml2AuthenticationExceptionMatcher (
291290 "invalid_issuer" ,
292291 containsString (
293- "Response issuer 'invalid issuer' doesn't match " +
294- "'https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php'"
292+ "Invalid issuer [invalid issuer] for SAML response"
295293 )
296294 )
297295 );
0 commit comments