Skip to content

Commit

Permalink
Return basic auth from google.Keychain (#791)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonjohnsonjr committed Oct 22, 2020
1 parent 25dfb32 commit 8a28419
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/v1/google/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ func (tsa *tokenSourceAuth) Authorization() (*authn.AuthConfig, error) {
}

return &authn.AuthConfig{
RegistryToken: token.AccessToken,
Username: "_token",
Password: token.AccessToken,
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/v1/google/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestGcloudSuccess(t *testing.T) {
t.Fatalf("Authorization got error %v", err)
}

if got, want := token.RegistryToken, "mytoken"; got != want {
if got, want := token.Password, "mytoken"; got != want {
t.Errorf("wanted token %q, got %q", want, got)
}
}
Expand Down

0 comments on commit 8a28419

Please sign in to comment.