grpc.io/content/en/docs/languages/go/alts.md

1.4 KiB

title short_title description weight spelling code
ALTS authentication in Go ALTS An overview of gRPC authentication in Go using Application Layer Transport Security (ALTS). 75 cSpell:ignore creds
client_credentials server_credentials server_authorization client_authorization
```go import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/alts" ) altsTC := alts.NewClientCreds(alts.DefaultClientOptions()) conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(altsTC)) ``` ```go import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/alts" ) altsTC := alts.NewServerCreds(alts.DefaultServerOptions()) server := grpc.NewServer(grpc.Creds(altsTC)) ``` ```go import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/alts" ) clientOpts := alts.DefaultClientOptions() clientOpts.TargetServiceAccounts = []string{expectedServerSA} altsTC := alts.NewClientCreds(clientOpts) conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(altsTC)) ``` ```go import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/alts" ) err := alts.ClientAuthorizationCheck(ctx, []string{"foo@iam.gserviceaccount.com"}) ```

{{% docs/auth_alts %}}