You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In an application where spring-security-saml2-service-provider was upgraded from 6.3.x to 6.4.1, I am experiencing a change in behaviour where I'm struggling to access the list of encrypted assertions in a validator class. I think this may be a bug.
I'm configuring a response validator in my configuration as Spring intends by doing this:
Having received a SAML Response with a single encrypted assertion, in said responseValidator, I'd be able to do something like this:
classSamlResponseValidatorimplementsConverter<ResponseToken, Saml2ResponseValidatorResult> {
@OverridepublicSaml2ResponseValidatorResultconvert(ResponseTokenresponseToken) {
// Without any other overrides, the below gives you the Spring-decrypted assertion:varassertions = responseToken.getResponse().getAssertions();
// In 6.3, the below would _also_ contain the still-encrypted assertions while// in 6.4, you'll always just get an empty list, it seems:varencryptedAssertions = responseToken.getResponse().getEncryptedAssertions();
// (...)
}
}
Execute the SAML flow with a SAML response containing an encrypted assertion and assert on/break point on encryptedAssertions
Notice that the value will be 0 instead of 1
Expected behavior
responseToken.getResponse().getEncryptedAssertions() should contain encrypted assertions
The log statement Decrypting EncryptedAssertion (%d/%d) in Response [%s] should log the correct count i.e. 1/1 if one encrypted assertion was found (instead of 0/1)
Sample
Because of 1) how basic this is and 2) this possibly being intentional, I have not included one yet but happy to add it if required.
Before creating this issue, I asked this as a Stack Overflow question but didn't get an answer.
Please tell me if I'm wrong or missing something! If you do agree, I don't mind creating a PR.
The text was updated successfully, but these errors were encountered:
Describe the bug
In an application where
spring-security-saml2-service-provider
was upgraded from6.3.x
to6.4.1
, I am experiencing a change in behaviour where I'm struggling to access the list of encrypted assertions in a validator class. I think this may be a bug.I'm configuring a response validator in my configuration as Spring intends by doing this:
Having received a SAML Response with a single encrypted assertion, in said
responseValidator
, I'd be able to do something like this:I can see that this change comes from what is now
OpenSaml4Template.OpenSaml4DecryptionConfigurer.decryptResponse(Response response)
which will do this:The Javadoc on the method states that:
Previously,
response.getEncryptedAssertions().removeAll(encrypteds)
did not exist.As a result, I believe there to be two bugs:
responseToken.getResponse().getEncryptedAssertions()
no longer contains encrypted assertions when Spring decrypted them for youint count = 0
in OpenSaml4Template.OpenSaml4DecryptionConfigurer.decryptResponse(Response response) results in incorrect log statements such asDecrypting EncryptedAssertion (0/1) in Response [{id}]
when there's only one assertionTo Reproduce
spring-security-saml2-service-provider
in which you provide your own response validator with:encryptedAssertions
0
instead of1
Expected behavior
responseToken.getResponse().getEncryptedAssertions()
should contain encrypted assertionsDecrypting EncryptedAssertion (%d/%d) in Response [%s]
should log the correct count i.e.1/1
if one encrypted assertion was found (instead of0/1
)Sample
Because of 1) how basic this is and 2) this possibly being intentional, I have not included one yet but happy to add it if required.
Before creating this issue, I asked this as a Stack Overflow question but didn't get an answer.
Please tell me if I'm wrong or missing something! If you do agree, I don't mind creating a PR.
The text was updated successfully, but these errors were encountered: