SAML-Toolkits / java-saml

Java SAML toolkit
MIT License
634 stars 398 forks source link

API consistency in SAML response messages validation #338

Open mauromol opened 3 years ago

mauromol commented 3 years ago

This issue is just to take note about the fact that there's a lack of consistency between:

The former returns false even if the SAML response is valid (i.e. it's well formed and correctly compiled) but the status code is different from SUCCESS. The latter does not check the status code, and returns true in case of a well-formed but unsuccessful logout response: apart from the obvious urn:oasis:names:tc:SAML:2.0:status:PartialLogout status code, looking at the list of possible status codes I think there are some that may also apply to a SLO scenario (being urn:oasis:names:tc:SAML:2.0:status:VersionMismatch the first one that comes ahead my eyes after a quick look).

Actually, I personally think that having isValid(String) return false in case of a non-successful response is not the best choice, because it makes harder for the consuming code to discriminate between a valid (but unsuccessful) response and a really invalid one (i.e.: not respecting SAML requirements for the given profile, invalid signatures, etc.). However, perhaps having both methods behave in the same way would be better in any case.

What do you think?