Skip to content

Commit

Permalink
Merge pull request #20 from shamus/chores/fix-auth-style
Browse files Browse the repository at this point in the history
Specify AuthStyle
  • Loading branch information
joefitzgerald authored Jul 14, 2019
2 parents d58dea9 + 556f9fc commit 0dc8535
Show file tree
Hide file tree
Showing 2 changed files with 227 additions and 203 deletions.
11 changes: 7 additions & 4 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func (a *API) validateClientCredentials() error {
ClientSecret: a.clientSecret,
TokenURL: tokenURL.String(),
EndpointParams: v,
AuthStyle: oauth2.AuthStyleInHeader,
}
a.clientCredentialsConfig = c
a.AuthenticatedClient = c.Client(context.WithValue(context.Background(), oauth2.HTTPClient, a.UnauthenticatedClient))
Expand Down Expand Up @@ -304,7 +305,7 @@ func (a *API) Token(ctx context.Context) (*oauth2.Token, error) {
// NewWithAuthorizationCode builds an API that uses the authorization code
// grant to get a token for use with the UAA API.
func NewWithAuthorizationCode(target string, zoneID string, clientID string, clientSecret string, authorizationCode string, tokenFormat TokenFormat, skipSSLValidation bool) (*API, error) {
a := New(target, zoneID).WithAuthorizationCode(clientID, clientSecret, authorizationCode, tokenFormat).WithSkipSSLValidation(skipSSLValidation)
a := New(target, zoneID).WithSkipSSLValidation(skipSSLValidation).WithAuthorizationCode(clientID, clientSecret, authorizationCode, tokenFormat)
err := a.Validate()
if err != nil {
return nil, err
Expand Down Expand Up @@ -332,7 +333,8 @@ func (a *API) validateAuthorizationCode() error {
ClientID: a.clientID,
ClientSecret: a.clientSecret,
Endpoint: oauth2.Endpoint{
TokenURL: tokenURL.String(),
TokenURL: tokenURL.String(),
AuthStyle: oauth2.AuthStyleInHeader,
},
}
a.oauthConfig = c
Expand All @@ -356,7 +358,7 @@ func (a *API) validateAuthorizationCode() error {
// NewWithRefreshToken builds an API that uses the given refresh token to get an
// access token for use with the UAA API.
func NewWithRefreshToken(target string, zoneID string, clientID string, clientSecret string, refreshToken string, tokenFormat TokenFormat, skipSSLValidation bool) (*API, error) {
a := New(target, zoneID).WithRefreshToken(clientID, clientSecret, refreshToken, tokenFormat).WithSkipSSLValidation(skipSSLValidation)
a := New(target, zoneID).WithSkipSSLValidation(skipSSLValidation).WithRefreshToken(clientID, clientSecret, refreshToken, tokenFormat)
err := a.Validate()
if err != nil {
return nil, err
Expand Down Expand Up @@ -387,7 +389,8 @@ func (a *API) validateRefreshToken() error {
ClientID: a.clientID,
ClientSecret: a.clientSecret,
Endpoint: oauth2.Endpoint{
TokenURL: tokenURL.String(),
TokenURL: tokenURL.String(),
AuthStyle: oauth2.AuthStyleInHeader,
},
}
a.oauthConfig = c
Expand Down
Loading

0 comments on commit 0dc8535

Please sign in to comment.