Fixed cpp auth documentation (which was not current).

reviewable/pr3765/r1
Julien Boeuf 9 years ago
parent e5adc0eb67
commit 9b2e11dee4
  1. 8
      doc/grpc-auth-support.md

@ -36,9 +36,9 @@ authenticate the server and encrypt all data.
```cpp ```cpp
SslCredentialsOptions ssl_opts; // Options to override SSL params, empty by default SslCredentialsOptions ssl_opts; // Options to override SSL params, empty by default
// Create the credentials object by providing service account key in constructor // Create the credentials object by providing service account key in constructor
std::unique_ptr<Credentials> creds = CredentialsFactory::SslCredentials(ssl_opts); std::shared_ptr<ChannelCredentials> creds = SslCredentials(ssl_opts);
// Create a channel using the credentials created in the previous step // Create a channel using the credentials created in the previous step
std::shared_ptr<ChannelInterface> channel = CreateChannel(server_name, creds, channel_args); std::shared_ptr<Channel> channel = CreateChannel(server_name, creds);
// Create a stub on the channel // Create a stub on the channel
std::unique_ptr<Greeter::Stub> stub(Greeter::NewStub(channel)); std::unique_ptr<Greeter::Stub> stub(Greeter::NewStub(channel));
// Make actual RPC calls on the stub. // Make actual RPC calls on the stub.
@ -55,9 +55,9 @@ passed to the factory method.
gRPC applications can use a simple API to create a credential that works in various deployment scenarios. gRPC applications can use a simple API to create a credential that works in various deployment scenarios.
```cpp ```cpp
std::unique_ptr<Credentials> creds = CredentialsFactory::GoogleDefaultCredentials(); std::shared_ptr<ChannelCredentials> creds = GoogleDefaultCredentials();
// Create a channel, stub and make RPC calls (same as in the previous example) // Create a channel, stub and make RPC calls (same as in the previous example)
std::shared_ptr<ChannelInterface> channel = CreateChannel(server_name, creds, channel_args); std::shared_ptr<Channel> channel = CreateChannel(server_name, creds);
std::unique_ptr<Greeter::Stub> stub(Greeter::NewStub(channel)); std::unique_ptr<Greeter::Stub> stub(Greeter::NewStub(channel));
grpc::Status s = stub->sayHello(&context, *request, response); grpc::Status s = stub->sayHello(&context, *request, response);
``` ```

Loading…
Cancel
Save