Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Encrypted assertions from Response lose reference to parent document #504

Open
davidjayb opened this issue Nov 6, 2020 · 0 comments
Open
Assignees
Labels
in: core An issue in spring-security-saml-core type: enhancement A general enhancement

Comments

@davidjayb
Copy link

During decryption, encrypted assertions lose the context of the parent (root) document. This is problematic if you need to access the parent document for any validation purposes of the authentication, such as to check the InResponseTo identifier.

The offending code:

        // Decrypt assertions
        if (response.getEncryptedAssertions().size() > 0) {
            assertionList = new ArrayList<Assertion>(response.getAssertions().size() + response.getEncryptedAssertions().size());
            assertionList.addAll(response.getAssertions());
            List<EncryptedAssertion> encryptedAssertionList = response.getEncryptedAssertions();
            for (EncryptedAssertion ea : encryptedAssertionList) {
                try {
                    Assert.notNull(context.getLocalDecrypter(), "Can't decrypt Assertion, no decrypter is set in the context");
                    log.debug("Decrypting assertion");
                    Assertion decryptedAssertion = context.getLocalDecrypter().decrypt(ea);
                    assertionList.add(decryptedAssertion);
                } catch (DecryptionException e) {
                    log.debug("Decryption of received assertion failed, assertion will be skipped", e);
                }
            }
        }

After the assertion is decrypted, the parent document reference should be set.

@jzheaux jzheaux self-assigned this Nov 12, 2020
@jzheaux jzheaux added in: core An issue in spring-security-saml-core type: enhancement A general enhancement labels Nov 12, 2020
@jzheaux jzheaux added this to the 1.0.11.RELEASE milestone Nov 12, 2020
@jzheaux jzheaux removed this from the 1.0.11.RELEASE milestone Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in: core An issue in spring-security-saml-core type: enhancement A general enhancement
Development

No branches or pull requests

2 participants