forked from remote/oauth2
google: unexport private structs and funcs
These structs and funcs cannot be used by the end consumer. Unexporting them helps cleans up our documentation
Change-Id: I2eadb69e87de912ac39f53e83cd9bdfe76a15e3e
GitHub-Last-Rev: 60b58eef75
GitHub-Pull-Request: golang/oauth2#479
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/293752
Reviewed-by: Cody Oss <codyoss@google.com>
Trust: Cody Oss <codyoss@google.com>
Trust: Tyler Bui-Palsulich <tbp@google.com>
Run-TryBot: Cody Oss <codyoss@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
@@ -15,13 +15,13 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var auth = ClientAuthentication{
|
||||
var auth = clientAuthentication{
|
||||
AuthStyle: oauth2.AuthStyleInHeader,
|
||||
ClientID: clientID,
|
||||
ClientSecret: clientSecret,
|
||||
}
|
||||
|
||||
var tokenRequest = STSTokenExchangeRequest{
|
||||
var tokenRequest = stsTokenExchangeRequest{
|
||||
ActingParty: struct {
|
||||
ActorToken string
|
||||
ActorTokenType string
|
||||
@@ -37,7 +37,7 @@ var tokenRequest = STSTokenExchangeRequest{
|
||||
|
||||
var requestbody = "audience=32555940559.apps.googleusercontent.com&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&subject_token=Sample.Subject.Token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Ajwt"
|
||||
var responseBody = `{"access_token":"Sample.Access.Token","issued_token_type":"urn:ietf:params:oauth:token-type:access_token","token_type":"Bearer","expires_in":3600,"scope":"https://www.googleapis.com/auth/cloud-platform"}`
|
||||
var expectedToken = STSTokenExchangeResponse{
|
||||
var expectedToken = stsTokenExchangeResponse{
|
||||
AccessToken: "Sample.Access.Token",
|
||||
IssuedTokenType: "urn:ietf:params:oauth:token-type:access_token",
|
||||
TokenType: "Bearer",
|
||||
@@ -75,9 +75,9 @@ func TestExchangeToken(t *testing.T) {
|
||||
headers := http.Header{}
|
||||
headers.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
resp, err := ExchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, nil)
|
||||
resp, err := exchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("ExchangeToken failed with error: %v", err)
|
||||
t.Fatalf("exchangeToken failed with error: %v", err)
|
||||
}
|
||||
|
||||
if expectedToken != *resp {
|
||||
@@ -95,7 +95,7 @@ func TestExchangeToken_Err(t *testing.T) {
|
||||
|
||||
headers := http.Header{}
|
||||
headers.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
_, err := ExchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, nil)
|
||||
_, err := exchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, nil)
|
||||
if err == nil {
|
||||
t.Errorf("Expected handled error; instead got nil.")
|
||||
}
|
||||
@@ -179,5 +179,5 @@ func TestExchangeToken_Opts(t *testing.T) {
|
||||
inputOpts := make(map[string]interface{})
|
||||
inputOpts["one"] = firstOption
|
||||
inputOpts["two"] = secondOption
|
||||
ExchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, inputOpts)
|
||||
exchangeToken(context.Background(), ts.URL, &tokenRequest, auth, headers, inputOpts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user