Skip to content

Commit

Permalink
Allow interop client to use call creds on any secure channel (grpc#2185)
Browse files Browse the repository at this point in the history
  • Loading branch information
apolcyn authored and dfawley committed Jun 28, 2018
1 parent 40a879c commit 6a43dcc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions interop/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ func main() {
creds = credentials.NewClientTLSFromCert(nil, sn)
}
opts = append(opts, grpc.WithTransportCredentials(creds))
} else if *useALTS {
altsOpts := alts.DefaultClientOptions()
if *altsHSAddr != "" {
altsOpts.HandshakerServiceAddress = *altsHSAddr
}
altsTC := alts.NewClientCreds(altsOpts)
opts = append(opts, grpc.WithTransportCredentials(altsTC))
} else {
opts = append(opts, grpc.WithInsecure())
}
if *useTLS || *useALTS {
if *testCase == "compute_engine_creds" {
opts = append(opts, grpc.WithPerRPCCredentials(oauth.NewComputeEngine()))
} else if *testCase == "service_account_creds" {
Expand All @@ -113,15 +124,6 @@ func main() {
} else if *testCase == "oauth2_auth_token" {
opts = append(opts, grpc.WithPerRPCCredentials(oauth.NewOauthAccess(interop.GetToken(*serviceAccountKeyFile, *oauthScope))))
}
} else if *useALTS {
altsOpts := alts.DefaultClientOptions()
if *altsHSAddr != "" {
altsOpts.HandshakerServiceAddress = *altsHSAddr
}
altsTC := alts.NewClientCreds(altsOpts)
opts = append(opts, grpc.WithTransportCredentials(altsTC))
} else {
opts = append(opts, grpc.WithInsecure())
}
opts = append(opts, grpc.WithBlock())
conn, err := grpc.Dial(serverAddr, opts...)
Expand Down

0 comments on commit 6a43dcc

Please sign in to comment.