This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
fix: url encode UAA oAuth client credentials #26
Merged
Merged
Conversation
This file contains 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
Although this header was base64 encoded, the oAuth spec requires that is also be url encoded. This was causing client credentials that contained special characters (e.g. `+`) to be rejected by UAA. See: > The client identifier is encoded using the "application/x-www-form-urlencoded" encoding algorithm per Appendix B, and the encoded value is used as the username; the client password is encoded using the same algorithm and used as the password. https://tools.ietf.org/html/rfc6749#section-2.3.1 Related: golang/oauth2#320 [#171268188](https://www.pivotaltracker.com/story/show/171268188)
XanderStrike
approved these changes
Feb 19, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swag
ndhanushkodi
approved these changes
Feb 19, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
tcdowney
commented
Feb 19, 2020
dolfolife
approved these changes
Feb 19, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -20,12 +21,14 @@ type jsonClient interface { | |||
|
|||
func (c *Client) GetToken() (string, error) { | |||
reqURL := fmt.Sprintf("%s/oauth/token", c.BaseURL) | |||
bodyString := fmt.Sprintf("client_id=%s&grant_type=client_credentials", c.Name) | |||
bodyString := fmt.Sprintf("grant_type=client_credentials") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not need client_id
anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client looks older now, no need to proof with ID.
routing-ci
pushed a commit
that referenced
this pull request
Sep 15, 2020
fix: put CF vars to unique temp dir
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Although this header was base64 encoded, the oAuth spec requires
that is also be url encoded. This was causing client credentials
that contained special characters (e.g.
+
) to be rejected by UAA:https://tools.ietf.org/html/rfc6749#section-2.3.1
Related:
golang/oauth2#320
Tracker Story:
#171268188
Thanks to @joshuatcasey for helping me make sense of the oAuth spec!