Skip to content

Commit a6dc5eb

Browse files
changes request by @bojeil
1 parent 930d60d commit a6dc5eb

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

google/internal/externalaccount/basecredentials_test.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ var testConfig = Config{
3737
}
3838

3939
var (
40-
baseCredsRequestBody = "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=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Ajwt"
40+
baseCredsRequestBody = "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=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aid_token"
4141
baseCredsResponseBody = `{"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"}`
42-
workforcePoolRequestBodyWithClientId = "audience=%2F%2Fiam.googleapis.com%2Flocations%2Feu%2FworkforcePools%2Fpool-id%2Fproviders%2Fprovider-id&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=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Ajwt"
43-
workforcePoolRequestBodyWithoutClientId = "audience=%2F%2Fiam.googleapis.com%2Flocations%2Feu%2FworkforcePools%2Fpool-id%2Fproviders%2Fprovider-id&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&options=%7B%22userProject%22%3A%22myProject%22%7D&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&subject_token=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Ajwt"
42+
workforcePoolRequestBodyWithClientId = "audience=%2F%2Fiam.googleapis.com%2Flocations%2Feu%2FworkforcePools%2Fpool-id%2Fproviders%2Fprovider-id&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=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aid_token"
43+
workforcePoolRequestBodyWithoutClientId = "audience=%2F%2Fiam.googleapis.com%2Flocations%2Feu%2FworkforcePools%2Fpool-id%2Fproviders%2Fprovider-id&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&options=%7B%22userProject%22%3A%22myProject%22%7D&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&subject_token=street123&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aid_token"
4444
correctAT = "Sample.Access.Token"
4545
expiry int64 = 234852
4646
)
@@ -110,8 +110,7 @@ func validateToken(t *testing.T, tok *oauth2.Token) {
110110
func TestToken(t *testing.T) {
111111
config := Config{
112112
Audience: "32555940559.apps.googleusercontent.com",
113-
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
114-
TokenInfoURL: "http://localhost:8080/v1/tokeninfo",
113+
SubjectTokenType: "urn:ietf:params:oauth:token-type:id_token",
115114
ClientSecret: "notsosecret",
116115
ClientID: "rbrgnognrhongo3bi4gb9ghg9g",
117116
CredentialSource: testBaseCredSource,
@@ -137,8 +136,7 @@ func TestToken(t *testing.T) {
137136
func TestWorkforcePoolTokenWithClientID(t *testing.T) {
138137
config := Config{
139138
Audience: "//iam.googleapis.com/locations/eu/workforcePools/pool-id/providers/provider-id",
140-
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
141-
TokenInfoURL: "http://localhost:8080/v1/tokeninfo",
139+
SubjectTokenType: "urn:ietf:params:oauth:token-type:id_token",
142140
ClientSecret: "notsosecret",
143141
ClientID: "rbrgnognrhongo3bi4gb9ghg9g",
144142
CredentialSource: testBaseCredSource,
@@ -165,8 +163,7 @@ func TestWorkforcePoolTokenWithClientID(t *testing.T) {
165163
func TestWorkforcePoolTokenWithoutClientID(t *testing.T) {
166164
config := Config{
167165
Audience: "//iam.googleapis.com/locations/eu/workforcePools/pool-id/providers/provider-id",
168-
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
169-
TokenInfoURL: "http://localhost:8080/v1/tokeninfo",
166+
SubjectTokenType: "urn:ietf:params:oauth:token-type:id_token",
170167
ClientSecret: "notsosecret",
171168
CredentialSource: testBaseCredSource,
172169
Scopes: []string{"https://www.googleapis.com/auth/devstorage.full_control"},
@@ -192,8 +189,7 @@ func TestWorkforcePoolTokenWithoutClientID(t *testing.T) {
192189
func TestNonworkforceWithWorkforcePoolUserProject(t *testing.T) {
193190
config := Config{
194191
Audience: "32555940559.apps.googleusercontent.com",
195-
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
196-
TokenInfoURL: "http://localhost:8080/v1/tokeninfo",
192+
SubjectTokenType: "urn:ietf:params:oauth:token-type:id_token",
197193
TokenURL: "https://sts.googleapis.com",
198194
ClientSecret: "notsosecret",
199195
ClientID: "rbrgnognrhongo3bi4gb9ghg9g",

0 commit comments

Comments
 (0)