fix(provider/docker): Support multiple challenges from WWW-Authenticate
header (backport #6139)
#6175
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 spinnaker/spinnaker#6922.
Ultimately, considers the
WWW-Authenticate
header value as aList<String>
as opposed to casting it directly to aString
.According to Mozilla's
WWW-Authenticate
header documentation, it is possible for the server to respond with multiple challenges through multiple header values. As such, I decided not to simply fetch the first header value, but now loop over the values and handle the first to match thebearer
orbasic
prefix. It might be time to extract this to a separate method, but I kept the diff as small as possible.I am not too familiar with Groovy nor Spock, so feel free to apply improvements where you deem fit.
The first commit serves as a regression test that the second commit fixes.
This is an automatic backport of pull request #6139 done by [Mergify](https://mergify.com).