Skip to content

Commit 8a28419

Browse files
authored
Return basic auth from google.Keychain (#791)
Before, we were taking advantage of the fact that GCR will allow you to just send an access token as bearer auth, but apparently this breaks `gcrane cp` if it's your first push to a registry, so this change returns basic auth to force us to always do a token exchange.
1 parent 25dfb32 commit 8a28419

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: pkg/v1/google/auth.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ func (tsa *tokenSourceAuth) Authorization() (*authn.AuthConfig, error) {
118118
}
119119

120120
return &authn.AuthConfig{
121-
RegistryToken: token.AccessToken,
121+
Username: "_token",
122+
Password: token.AccessToken,
122123
}, nil
123124
}
124125

Diff for: pkg/v1/google/auth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestGcloudSuccess(t *testing.T) {
135135
t.Fatalf("Authorization got error %v", err)
136136
}
137137

138-
if got, want := token.RegistryToken, "mytoken"; got != want {
138+
if got, want := token.Password, "mytoken"; got != want {
139139
t.Errorf("wanted token %q, got %q", want, got)
140140
}
141141
}

0 commit comments

Comments
 (0)