Skip to content

Fix extraction of the response issuer#333

Merged
pitbulk merged 2 commits intoSAML-Toolkits:masterfrom
mauromol:fix-response-issuer-retrieval
Jun 24, 2021
Merged

Fix extraction of the response issuer#333
pitbulk merged 2 commits intoSAML-Toolkits:masterfrom
mauromol:fix-response-issuer-retrieval

Conversation

@mauromol
Copy link
Copy Markdown
Contributor

A ">1" in place of a ">0" was causing the inability to extract the
Response issuer(s) correctly.
Added a test case to check this.
Fixed another test case that should (IMHO) return an error regarding
the issuer, rather than the signature.

A ">1" in place of a ">0" was causing the inability to extract the
Response issuer(s) correctly.
Added a test case to check this.
Fixed another test case that should (IMHO) return an error regarding
the issuer, rather than the signature.
The SamlResponse.getIssuers() contract is quite controversial. For a
valid response, it will always return just one element. For an invalid
response, depending on the cause it may:
- fail if no Assertion is present: this means, in particular, that if
the status code is not a success one, it's impossible to retrieve the
Response issuer with this method (although it may be a reasonable
requirement, for logging purposes for instance)
- fail if multiple Assertions are present: again, the Response Issuer
cannot be retrieved in this case either
- fail in the unlikely event that multiple Response Issuers were found
- return up to 2 issuers at most, if different issuers were set on the
Response and on the Assertion (which will make isValid() fail), with the
inability to determine which is the Response Issuer and which is the
Assertion Issuer (indeed: the former will be the first one in the
list, the latter will be the second, but this contract is a bit weak)

For these reasons, two different methods were provided to retrieve the
Response and the Assertion Issuers, with the former that will succeed
even when the status code is not a successful one. Also, because of the
above reasons, the getIssuers() method was deprecated in favour of the
two new ones.
@mauromol
Copy link
Copy Markdown
Contributor Author

I added a second commit which will split getIssuers() into getResponseIssuer() and getAssertionIssuer(). The main motivation lies in the inability to retrieve the Response issuer whenever a response with a status code != SUCCESS is processed. The details are described in the commit message.

@pitbulk pitbulk force-pushed the master branch 3 times, most recently from ab7e4d7 to 3c79c8c Compare May 18, 2021 00:32
@pitbulk pitbulk merged commit 6233278 into SAML-Toolkits:master Jun 24, 2021
@mauromol mauromol deleted the fix-response-issuer-retrieval branch July 14, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants