Repository navigation
AuthScope: added ChallengeType attribute - #934
Conversation
|
@Hsnmohd Please review |
Hsnmohd
left a comment
There was a problem hiding this comment.
Ran the auth unit tests on 463413e, they pass. A few things:
-
BearerSchemeandScramSchemetakechallengeTypebut still build the scope withnew AuthScope(host, realm, getName()), so it's dropped. With aBasicCredentialsProviderholding a token undernew AuthScope(null, null, -1, null, "Bearer", ChallengeType.PROXY), a 401 Bearer challenge from any origin gets that token (Basic correctly refuses the same setup). Both should passchallengeTypethrough. SCRAM also needs to keep it for theCOMPLETEre-auth ingenerateAuthResponse, which calls the 3-argisResponseReadyand ends up untyped. -
In
match, challenge type gets +32, which outranks host (+16). Givennew AuthScope(null, null, -1, null, null, ChallengeType.TARGET)andnew AuthScope("api.example.com", 443), a TARGET request to api.example.com:443 picks the wildcard. I'd give challenge type the lowest weight so it only breaks ties between otherwise equal scopes. -
SystemDefaultCredentialsProvideris unchanged, so on a TARGET scope it still asks theAuthenticatorfor SERVER then PROXY and returns the proxy credentials. That's the part #925 covers. I'll rebase it onto this once it's in.
Nits: the javadoc for the existing (protocol, host, port, realm, schemeName) and (HttpHost, realm, schemeName) constructors moved onto the new overloads, so the old ones lost their docs (and @since 4.2), and the new ones don't document challengeType. Also "AutScope" in the commit subject.
Probably worth a release note: custom providers that look credentials up by equals on an untyped AuthScope will miss now that the built-in schemes send typed scopes.
I agree that |
463413e to
15c5be1
Compare
@Hsnmohd @arturobernalg I am getting old. Corrected.
Agreed. Corrected.
This is intentional. My changes were not intended to conflict with your pull request, but to provide the necessary foundation. |
AutScopenow includesChallengeTypeas an additional attribute@arturobernalg Please double-check.