```cpp
#include <grpcpp/grpcpp.h>
#include <grpcpp/security/credentials.h>
using grpc::experimental::AltsCredentials;
using grpc::experimental::AltsCredentialsOptions;
auto creds = AltsCredentials(AltsCredentialsOptions());
std::shared_ptr<grpc::Channel> channel = CreateChannel(server_address, creds);
```
|
```cpp
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/server.h>
#include <grpcpp/server_builder.h>
using grpc::experimental::AltsServerCredentials;
using grpc::experimental::AltsServerCredentialsOptions;
grpc::ServerBuilder builder;
builder.RegisterService(&service);
auto creds = AltsServerCredentials(AltsServerCredentialsOptions());
builder.AddListeningPort("[::]:<port>", creds);
std::unique_ptr<Server> server(builder.BuildAndStart());
```
|
```cpp
#include <grpcpp/grpcpp.h>
#include <grpcpp/security/credentials.h>
using grpc::experimental::AltsCredentials;
using grpc::experimental::AltsCredentialsOptions;
AltsCredentialsOptions opts;
opts.target_service_accounts.push_back("expected_server_service_account1");
opts.target_service_accounts.push_back("expected_server_service_account2");
auto creds = AltsCredentials(opts);
std::shared_ptr<grpc::Channel> channel = CreateChannel(server_address, creds);
```
|
```cpp
#include <grpcpp/server_context.h>
#include <grpcpp/security/alts_util.h>
grpc::ServerContext* context;
grpc::Status status = experimental::AltsClientAuthzCheck(
context->auth_context(), {"foo@iam.gserviceaccount.com"});
```
|