fix: prep_for_nego_auth: avoid double signing redirect requests #973
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #819 (again)
The prepare_for_negotiated_authenticate method has sign parameter defaulting to None.
The logic setting
sign_redirect
andsign_post
does not properly handle the three-state aspects thatsign
has withNone
mixed withTrue
andFalse
.Python evalutes
None and <any value>
asNone
, so as a result,None
gets passed for bothsign_redirect
andsign_post
.However,
None
is interpreted byEntity._message
as "signif self.should_sign
".As a result, for Redirect binding, the authentication request gets signed both in XML and in HTTP parameter (recurrence of #819).
Fix this by passing an explicit
False
for exactly one of the branches (sign_post for REDIRECT binding and sign_redirect for all other bindings), passing through value ofsign
for the other branch.Description
The feature or problem addressed by this PR
Fix double signing of of Authentication requests with redirect binding.
What your changes do and why you chose this solution
Fix logic to avoid passing
None
for bothsign_post
andsign_redirect
(as they both get interpreted as "sign ifshould_sign
)Checklist