diff options
Diffstat (limited to 'include/grpc++/impl/codegen/client_context.h')
-rw-r--r-- | include/grpc++/impl/codegen/client_context.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h index aed12767a7..e23fd4eda3 100644 --- a/include/grpc++/impl/codegen/client_context.h +++ b/include/grpc++/impl/codegen/client_context.h @@ -55,6 +55,7 @@ #include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/core_codegen_interface.h> +#include <grpc++/impl/codegen/create_auth_context.h> #include <grpc++/impl/codegen/security/auth_context.h> #include <grpc++/impl/codegen/status.h> #include <grpc++/impl/codegen/string_ref.h> @@ -244,7 +245,12 @@ class ClientContext { /// Return the authentication context for this client call. /// /// \see grpc::AuthContext. - std::shared_ptr<const AuthContext> auth_context() const; + std::shared_ptr<const AuthContext> auth_context() const { + if (auth_context_.get() == nullptr) { + auth_context_ = CreateAuthContext(call_); + } + return auth_context_; + } /// Set credentials for the client call. /// |