1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Always require signature on either response or assertion

Fixes gh-7490
https://github.com/spring-projects/spring-security/issues/7490
This commit is contained in:
Filip Hanik
2019-09-28 11:52:53 -07:00
parent d83aa34dde
commit 7adb4da3ef
3 changed files with 40 additions and 4 deletions
@@ -163,14 +163,15 @@ public class Saml2LoginIntegrationTests {
EncryptedAssertion encryptedAssertion =
OpenSamlActionTestingSupport.encryptAssertion(assertion, decodeCertificate(spCertificate));
Response response = buildResponse(encryptedAssertion);
signXmlObject(assertion, getSigningCredential(idpCertificate, idpPrivateKey, UsageType.SIGNING));
signXmlObject(response, getSigningCredential(idpCertificate, idpPrivateKey, UsageType.SIGNING));
sendResponse(response, "/")
.andExpect(authenticated().withUsername(USERNAME));
}
@Test
public void authenticateWhenResponseIsNotSignedAndAssertionIsEncryptedThenItSucceeds() throws Exception {
public void authenticateWhenResponseIsNotSignedAndAssertionIsEncryptedAndSignedThenItSucceeds() throws Exception {
Assertion assertion = buildAssertion(USERNAME);
signXmlObject(assertion, getSigningCredential(idpCertificate, idpPrivateKey, UsageType.SIGNING));
EncryptedAssertion encryptedAssertion =
OpenSamlActionTestingSupport.encryptAssertion(assertion, decodeCertificate(spCertificate));
Response response = buildResponse(encryptedAssertion);