Repository navigation
Read the error response body when the auth endpoint returns an error status - #382
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes #261.
When the channel authorization or user authentication endpoint responds with a status of 400 or above,
HttpURLConnection.getInputStream()throws (FileNotFoundExceptionfor 404,IOException: Server returned HTTP response code: 403 ...for other codes). The response body the server sent is lost, and the status check that follows the read never runs for these codes. The resultingAuthorizationFailureExceptionorAuthenticationFailureExceptiononly carries the URL and status, not the reason the server gave.This change in
BaseHttpAuthClient:getErrorStream()for statuses of 400 and above.Server returned HTTP response code: <status>when the error response has no body.Successful responses are handled as before. New tests in
HttpChannelAuthorizerTestandHttpUserAuthenticatorTeststart a localHttpServerthat returns 403 with a JSON body and check that the exception message is that body. Both tests fail onmasterand pass with this change.CHANGELOG