forked from Mirrors/oauth2
Requested changes.
This commit is contained in:
parent
cdebe8a098
commit
ae11242ea6
|
@ -7,7 +7,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientAuthentication represents an OAuth client ID and secret and the mechanism for passing these credentials as stated in rfc6749#2.3.1
|
// ClientAuthentication represents an OAuth client ID and secret and the mechanism for passing these credentials as stated in rfc6749#2.3.1.
|
||||||
type ClientAuthentication struct {
|
type ClientAuthentication struct {
|
||||||
//Can be either basic or request-body
|
//Can be either basic or request-body
|
||||||
AuthStyle oauth2.AuthStyle
|
AuthStyle oauth2.AuthStyle
|
||||||
|
@ -15,7 +15,7 @@ type ClientAuthentication struct {
|
||||||
ClientSecret string
|
ClientSecret string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClientAuthentication) InjectAuthentication(values *url.Values, headers *http.Header) {
|
func (c *ClientAuthentication) InjectAuthentication(values url.Values, headers http.Header) {
|
||||||
if c.ClientID == "" || c.ClientSecret == "" || values == nil || headers == nil {
|
if c.ClientID == "" || c.ClientSecret == "" || values == nil || headers == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package externalaccount
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
//Struct for handling OAuth related error responses as stated in rfc6749#5.2
|
//Error for handling OAuth related error responses as stated in rfc6749#5.2.
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Code string
|
Code string
|
||||||
URI string
|
URI string
|
||||||
|
|
|
@ -8,8 +8,8 @@ func TestError_Generator(t *testing.T) {
|
||||||
"http:thisIsAPlaceholder",
|
"http:thisIsAPlaceholder",
|
||||||
"The Answer!",
|
"The Answer!",
|
||||||
}
|
}
|
||||||
output := "got error code " + "42" + " from " + "http:thisIsAPlaceholder" + ": " + "The Answer!"
|
want := "got error code " + "42" + " from " + "http:thisIsAPlaceholder" + ": " + "The Answer!"
|
||||||
if got, want := e, output; e.Error() != output {
|
if got := e.Error(); got != want {
|
||||||
t.Errorf("Got error message %q; want %q", got, want)
|
t.Errorf("Got error message %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue