jira: fix bug when upper-casing scopes

Fix for a small bug that causes scopes to be prefixed by a bunch
of `+` chars, which results in an invalid scopes response from
the Jira Auth Server.

Change-Id: I00ded66c1eeb042a02f11ef3c84d7281159b1039
GitHub-Last-Rev: f76f480589
GitHub-Pull-Request: golang/oauth2#282
Reviewed-on: https://go-review.googlesource.com/110917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Shaun Dunning 2018-05-02 17:41:25 +00:00 committed by Brad Fitzpatrick
parent 6881fee410
commit cdc340f7c1
1 changed files with 2 additions and 2 deletions

View File

@ -94,8 +94,8 @@ func (js jwtSource) Token() (*oauth2.Token, error) {
// Add scopes if they exist; If not, it defaults to app scopes // Add scopes if they exist; If not, it defaults to app scopes
if scopes := js.conf.Scopes; scopes != nil { if scopes := js.conf.Scopes; scopes != nil {
upperScopes := make([]string, len(scopes)) upperScopes := make([]string, len(scopes))
for _, k := range scopes { for i, k := range scopes {
upperScopes = append(upperScopes, strings.ToUpper(k)) upperScopes[i] = strings.ToUpper(k)
} }
v.Set("scope", strings.Join(upperScopes, "+")) v.Set("scope", strings.Join(upperScopes, "+"))
} }