Merge pull request #23611 from grpc/revert-23609-revert-23308-create-channel

Revert "Revert "Move create_channel and credentials from ::grpc_impl to ::grpc""
pull/23633/head
Karthik Ravi Shankar 5 years ago committed by GitHub
commit 8527ebb471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      BUILD
  2. 2
      BUILD.gn
  3. 4
      CMakeLists.txt
  4. 4
      Makefile
  5. 4
      build_autogenerated.yaml
  6. 2
      gRPC-C++.podspec
  7. 67
      include/grpcpp/create_channel.h
  8. 78
      include/grpcpp/create_channel_impl.h
  9. 13
      include/grpcpp/impl/codegen/client_context_impl.h
  10. 356
      include/grpcpp/security/credentials.h
  11. 356
      include/grpcpp/security/credentials_impl.h
  12. 5
      include/grpcpp/security/cronet_credentials.h
  13. 28
      include/grpcpp/security/server_credentials.h
  14. 2
      include/grpcpp/security/server_credentials_impl.h
  15. 4
      include/grpcpp/security/tls_credentials_options.h
  16. 5
      include/grpcpp/support/channel_arguments_impl.h
  17. 2
      src/cpp/client/client_context.cc
  18. 14
      src/cpp/client/create_channel.cc
  19. 4
      src/cpp/client/credentials_cc.cc
  20. 5
      src/cpp/client/cronet_credentials.cc
  21. 4
      src/cpp/client/insecure_credentials.cc
  22. 5
      src/cpp/client/secure_credentials.cc
  23. 8
      src/cpp/client/secure_credentials.h
  24. 4
      src/cpp/common/tls_credentials_options.cc
  25. 4
      src/cpp/common/tls_credentials_options_util.cc
  26. 4
      src/cpp/common/tls_credentials_options_util.h
  27. 4
      src/cpp/server/insecure_server_credentials.cc
  28. 6
      src/cpp/server/secure_server_credentials.cc
  29. 13
      src/cpp/server/secure_server_credentials.h
  30. 11
      test/core/security/fetch_oauth2.cc
  31. 29
      test/cpp/client/credentials_test.cc
  32. 2
      tools/doxygen/Doxyfile.c++
  33. 2
      tools/doxygen/Doxyfile.c++.internal

@ -225,7 +225,6 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/completion_queue_impl.h", "include/grpcpp/completion_queue_impl.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_impl.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
@ -251,7 +250,6 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/security/auth_context.h", "include/grpcpp/security/auth_context.h",
"include/grpcpp/security/auth_metadata_processor.h", "include/grpcpp/security/auth_metadata_processor.h",
"include/grpcpp/security/credentials.h", "include/grpcpp/security/credentials.h",
"include/grpcpp/security/credentials_impl.h",
"include/grpcpp/security/server_credentials.h", "include/grpcpp/security/server_credentials.h",
"include/grpcpp/security/server_credentials_impl.h", "include/grpcpp/security/server_credentials_impl.h",
"include/grpcpp/security/tls_credentials_options.h", "include/grpcpp/security/tls_credentials_options.h",

@ -1093,7 +1093,6 @@ config("grpc_config") {
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/completion_queue_impl.h", "include/grpcpp/completion_queue_impl.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_impl.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
@ -1177,7 +1176,6 @@ config("grpc_config") {
"include/grpcpp/security/auth_context.h", "include/grpcpp/security/auth_context.h",
"include/grpcpp/security/auth_metadata_processor.h", "include/grpcpp/security/auth_metadata_processor.h",
"include/grpcpp/security/credentials.h", "include/grpcpp/security/credentials.h",
"include/grpcpp/security/credentials_impl.h",
"include/grpcpp/security/server_credentials.h", "include/grpcpp/security/server_credentials.h",
"include/grpcpp/security/server_credentials_impl.h", "include/grpcpp/security/server_credentials_impl.h",
"include/grpcpp/security/tls_credentials_options.h", "include/grpcpp/security/tls_credentials_options.h",

@ -2732,7 +2732,6 @@ foreach(_hdr
include/grpcpp/completion_queue.h include/grpcpp/completion_queue.h
include/grpcpp/completion_queue_impl.h include/grpcpp/completion_queue_impl.h
include/grpcpp/create_channel.h include/grpcpp/create_channel.h
include/grpcpp/create_channel_impl.h
include/grpcpp/create_channel_posix.h include/grpcpp/create_channel_posix.h
include/grpcpp/ext/health_check_service_server_builder_option.h include/grpcpp/ext/health_check_service_server_builder_option.h
include/grpcpp/generic/async_generic_service.h include/grpcpp/generic/async_generic_service.h
@ -2816,7 +2815,6 @@ foreach(_hdr
include/grpcpp/security/auth_context.h include/grpcpp/security/auth_context.h
include/grpcpp/security/auth_metadata_processor.h include/grpcpp/security/auth_metadata_processor.h
include/grpcpp/security/credentials.h include/grpcpp/security/credentials.h
include/grpcpp/security/credentials_impl.h
include/grpcpp/security/server_credentials.h include/grpcpp/security/server_credentials.h
include/grpcpp/security/server_credentials_impl.h include/grpcpp/security/server_credentials_impl.h
include/grpcpp/security/tls_credentials_options.h include/grpcpp/security/tls_credentials_options.h
@ -3426,7 +3424,6 @@ foreach(_hdr
include/grpcpp/completion_queue.h include/grpcpp/completion_queue.h
include/grpcpp/completion_queue_impl.h include/grpcpp/completion_queue_impl.h
include/grpcpp/create_channel.h include/grpcpp/create_channel.h
include/grpcpp/create_channel_impl.h
include/grpcpp/create_channel_posix.h include/grpcpp/create_channel_posix.h
include/grpcpp/ext/health_check_service_server_builder_option.h include/grpcpp/ext/health_check_service_server_builder_option.h
include/grpcpp/generic/async_generic_service.h include/grpcpp/generic/async_generic_service.h
@ -3510,7 +3507,6 @@ foreach(_hdr
include/grpcpp/security/auth_context.h include/grpcpp/security/auth_context.h
include/grpcpp/security/auth_metadata_processor.h include/grpcpp/security/auth_metadata_processor.h
include/grpcpp/security/credentials.h include/grpcpp/security/credentials.h
include/grpcpp/security/credentials_impl.h
include/grpcpp/security/server_credentials.h include/grpcpp/security/server_credentials.h
include/grpcpp/security/server_credentials_impl.h include/grpcpp/security/server_credentials_impl.h
include/grpcpp/security/tls_credentials_options.h include/grpcpp/security/tls_credentials_options.h

@ -4869,7 +4869,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/completion_queue_impl.h \ include/grpcpp/completion_queue_impl.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_impl.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
@ -4953,7 +4952,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \ include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials.h \
include/grpcpp/security/credentials_impl.h \
include/grpcpp/security/server_credentials.h \ include/grpcpp/security/server_credentials.h \
include/grpcpp/security/server_credentials_impl.h \ include/grpcpp/security/server_credentials_impl.h \
include/grpcpp/security/tls_credentials_options.h \ include/grpcpp/security/tls_credentials_options.h \
@ -5561,7 +5559,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/completion_queue_impl.h \ include/grpcpp/completion_queue_impl.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_impl.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
@ -5645,7 +5642,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \ include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials.h \
include/grpcpp/security/credentials_impl.h \
include/grpcpp/security/server_credentials.h \ include/grpcpp/security/server_credentials.h \
include/grpcpp/security/server_credentials_impl.h \ include/grpcpp/security/server_credentials_impl.h \
include/grpcpp/security/tls_credentials_options.h \ include/grpcpp/security/tls_credentials_options.h \

@ -2068,7 +2068,6 @@ libs:
- include/grpcpp/completion_queue.h - include/grpcpp/completion_queue.h
- include/grpcpp/completion_queue_impl.h - include/grpcpp/completion_queue_impl.h
- include/grpcpp/create_channel.h - include/grpcpp/create_channel.h
- include/grpcpp/create_channel_impl.h
- include/grpcpp/create_channel_posix.h - include/grpcpp/create_channel_posix.h
- include/grpcpp/ext/health_check_service_server_builder_option.h - include/grpcpp/ext/health_check_service_server_builder_option.h
- include/grpcpp/generic/async_generic_service.h - include/grpcpp/generic/async_generic_service.h
@ -2152,7 +2151,6 @@ libs:
- include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_context.h
- include/grpcpp/security/auth_metadata_processor.h - include/grpcpp/security/auth_metadata_processor.h
- include/grpcpp/security/credentials.h - include/grpcpp/security/credentials.h
- include/grpcpp/security/credentials_impl.h
- include/grpcpp/security/server_credentials.h - include/grpcpp/security/server_credentials.h
- include/grpcpp/security/server_credentials_impl.h - include/grpcpp/security/server_credentials_impl.h
- include/grpcpp/security/tls_credentials_options.h - include/grpcpp/security/tls_credentials_options.h
@ -2454,7 +2452,6 @@ libs:
- include/grpcpp/completion_queue.h - include/grpcpp/completion_queue.h
- include/grpcpp/completion_queue_impl.h - include/grpcpp/completion_queue_impl.h
- include/grpcpp/create_channel.h - include/grpcpp/create_channel.h
- include/grpcpp/create_channel_impl.h
- include/grpcpp/create_channel_posix.h - include/grpcpp/create_channel_posix.h
- include/grpcpp/ext/health_check_service_server_builder_option.h - include/grpcpp/ext/health_check_service_server_builder_option.h
- include/grpcpp/generic/async_generic_service.h - include/grpcpp/generic/async_generic_service.h
@ -2538,7 +2535,6 @@ libs:
- include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_context.h
- include/grpcpp/security/auth_metadata_processor.h - include/grpcpp/security/auth_metadata_processor.h
- include/grpcpp/security/credentials.h - include/grpcpp/security/credentials.h
- include/grpcpp/security/credentials_impl.h
- include/grpcpp/security/server_credentials.h - include/grpcpp/security/server_credentials.h
- include/grpcpp/security/server_credentials_impl.h - include/grpcpp/security/server_credentials_impl.h
- include/grpcpp/security/tls_credentials_options.h - include/grpcpp/security/tls_credentials_options.h

@ -84,7 +84,6 @@ Pod::Spec.new do |s|
'include/grpcpp/completion_queue.h', 'include/grpcpp/completion_queue.h',
'include/grpcpp/completion_queue_impl.h', 'include/grpcpp/completion_queue_impl.h',
'include/grpcpp/create_channel.h', 'include/grpcpp/create_channel.h',
'include/grpcpp/create_channel_impl.h',
'include/grpcpp/create_channel_posix.h', 'include/grpcpp/create_channel_posix.h',
'include/grpcpp/ext/health_check_service_server_builder_option.h', 'include/grpcpp/ext/health_check_service_server_builder_option.h',
'include/grpcpp/generic/async_generic_service.h', 'include/grpcpp/generic/async_generic_service.h',
@ -164,7 +163,6 @@ Pod::Spec.new do |s|
'include/grpcpp/security/auth_context.h', 'include/grpcpp/security/auth_context.h',
'include/grpcpp/security/auth_metadata_processor.h', 'include/grpcpp/security/auth_metadata_processor.h',
'include/grpcpp/security/credentials.h', 'include/grpcpp/security/credentials.h',
'include/grpcpp/security/credentials_impl.h',
'include/grpcpp/security/server_credentials.h', 'include/grpcpp/security/server_credentials.h',
'include/grpcpp/security/server_credentials_impl.h', 'include/grpcpp/security/server_credentials_impl.h',
'include/grpcpp/security/tls_credentials_options.h', 'include/grpcpp/security/tls_credentials_options.h',

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2015 gRPC authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,36 +19,59 @@
#ifndef GRPCPP_CREATE_CHANNEL_H #ifndef GRPCPP_CREATE_CHANNEL_H
#define GRPCPP_CREATE_CHANNEL_H #define GRPCPP_CREATE_CHANNEL_H
#include <grpcpp/create_channel_impl.h> #include <memory>
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h> #include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
namespace grpc { namespace grpc {
/// Create a new \a Channel pointing to \a target.
///
/// \param target The URI of the endpoint to connect to.
/// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned.
std::shared_ptr<Channel> CreateChannel(
const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds);
static inline std::shared_ptr<::grpc::Channel> CreateChannel( /// Create a new \em custom \a Channel pointing to \a target.
const std::string& target, ///
const std::shared_ptr<ChannelCredentials>& creds) { /// \warning For advanced use and testing ONLY. Override default channel
return ::grpc_impl::CreateChannelImpl(target, creds); /// arguments only if necessary.
} ///
/// \param target The URI of the endpoint to connect to.
static inline std::shared_ptr<::grpc::Channel> CreateCustomChannel( /// \param creds Credentials to use for the created channel. If it does not
const std::string& target, const std::shared_ptr<ChannelCredentials>& creds, /// hold an object or is invalid, a lame channel (one on which all operations
const ChannelArguments& args) { /// fail) is returned.
return ::grpc_impl::CreateCustomChannelImpl(target, creds, args); /// \param args Options for channel creation.
} std::shared_ptr<Channel> CreateCustomChannel(
const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args);
namespace experimental { namespace experimental {
/// Create a new \em custom \a Channel pointing to \a target with \a
static inline std::shared_ptr<::grpc::Channel> /// interceptors being invoked per call.
CreateCustomChannelWithInterceptors( ///
const std::string& target, const std::shared_ptr<ChannelCredentials>& creds, /// \warning For advanced use and testing ONLY. Override default channel
/// arguments only if necessary.
///
/// \param target The URI of the endpoint to connect to.
/// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned.
/// \param args Options for channel creation.
std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args, const ChannelArguments& args,
std::vector< std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) { interceptor_creators);
return ::grpc_impl::experimental::CreateCustomChannelWithInterceptors(
target, creds, args, std::move(interceptor_creators));
}
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -1,78 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_CREATE_CHANNEL_IMPL_H
#define GRPCPP_CREATE_CHANNEL_IMPL_H
#include <memory>
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
namespace grpc_impl {
/// Create a new \a Channel pointing to \a target.
///
/// \param target The URI of the endpoint to connect to.
/// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned.
std::shared_ptr<::grpc::Channel> CreateChannelImpl(
const std::string& target,
const std::shared_ptr<::grpc::ChannelCredentials>& creds);
/// Create a new \em custom \a Channel pointing to \a target.
///
/// \warning For advanced use and testing ONLY. Override default channel
/// arguments only if necessary.
///
/// \param target The URI of the endpoint to connect to.
/// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned.
/// \param args Options for channel creation.
std::shared_ptr<::grpc::Channel> CreateCustomChannelImpl(
const std::string& target,
const std::shared_ptr<::grpc::ChannelCredentials>& creds,
const ::grpc::ChannelArguments& args);
namespace experimental {
/// Create a new \em custom \a Channel pointing to \a target with \a
/// interceptors being invoked per call.
///
/// \warning For advanced use and testing ONLY. Override default channel
/// arguments only if necessary.
///
/// \param target The URI of the endpoint to connect to.
/// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned.
/// \param args Options for channel creation.
std::shared_ptr<::grpc::Channel> CreateCustomChannelWithInterceptors(
const std::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds,
const ::grpc::ChannelArguments& args,
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
} // namespace experimental
} // namespace grpc_impl
#endif // GRPCPP_CREATE_CHANNEL_IMPL_H

@ -58,6 +58,7 @@ struct grpc_call;
namespace grpc { namespace grpc {
class CallCredentials;
class ChannelInterface; class ChannelInterface;
namespace internal { namespace internal {
@ -88,7 +89,6 @@ class ClientCallbackUnaryImpl;
class ClientContextAccessor; class ClientContextAccessor;
} // namespace internal } // namespace internal
class CallCredentials;
class Channel; class Channel;
class CompletionQueue; class CompletionQueue;
class ServerContext; class ServerContext;
@ -318,16 +318,15 @@ class ClientContext {
/// ///
/// It is legal to call this only before initial metadata is sent. /// It is legal to call this only before initial metadata is sent.
/// ///
/// \see https://grpc.io/docs/guides/auth /// \see https://grpc.io/docs/guides/auth.html
void set_credentials( void set_credentials(const std::shared_ptr<grpc::CallCredentials>& creds);
const std::shared_ptr<grpc_impl::CallCredentials>& creds);
/// EXPERIMENTAL debugging API /// EXPERIMENTAL debugging API
/// ///
/// Returns the credentials for the client call. This should be used only in /// Returns the credentials for the client call. This should be used only in
/// tests and for diagnostic purposes, and should not be used by application /// tests and for diagnostic purposes, and should not be used by application
/// logic. /// logic.
std::shared_ptr<grpc_impl::CallCredentials> credentials() { return creds_; } std::shared_ptr<grpc::CallCredentials> credentials() { return creds_; }
/// Return the compression algorithm the client call will request be used. /// Return the compression algorithm the client call will request be used.
/// Note that the gRPC runtime may decide to ignore this request, for example, /// Note that the gRPC runtime may decide to ignore this request, for example,
@ -494,8 +493,8 @@ class ClientContext {
grpc_call* call_; grpc_call* call_;
bool call_canceled_; bool call_canceled_;
gpr_timespec deadline_; gpr_timespec deadline_;
std::string authority_; grpc::string authority_;
std::shared_ptr<grpc_impl::CallCredentials> creds_; std::shared_ptr<grpc::CallCredentials> creds_;
mutable std::shared_ptr<const grpc::AuthContext> auth_context_; mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
struct census_context* census_context_; struct census_context* census_context_;
std::multimap<std::string, std::string> send_initial_metadata_; std::multimap<std::string, std::string> send_initial_metadata_;

@ -19,123 +19,301 @@
#ifndef GRPCPP_SECURITY_CREDENTIALS_H #ifndef GRPCPP_SECURITY_CREDENTIALS_H
#define GRPCPP_SECURITY_CREDENTIALS_H #define GRPCPP_SECURITY_CREDENTIALS_H
#include <grpcpp/security/credentials_impl.h> #include <map>
#include <memory>
#include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/security/auth_context.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
struct grpc_call;
namespace grpc { namespace grpc {
class CallCredentials;
class SecureCallCredentials;
class SecureChannelCredentials;
class ChannelCredentials;
typedef ::grpc_impl::ChannelCredentials ChannelCredentials; std::shared_ptr<Channel> CreateCustomChannel(
typedef ::grpc_impl::CallCredentials CallCredentials; const grpc::string& target,
typedef ::grpc_impl::SslCredentialsOptions SslCredentialsOptions; const std::shared_ptr<grpc::ChannelCredentials>& creds,
typedef ::grpc_impl::SecureCallCredentials SecureCallCredentials; const grpc::ChannelArguments& args);
typedef ::grpc_impl::SecureChannelCredentials SecureChannelCredentials;
typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin;
static inline std::shared_ptr<grpc_impl::ChannelCredentials> namespace experimental {
GoogleDefaultCredentials() { std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
return ::grpc_impl::GoogleDefaultCredentials(); const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args,
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
} }
static inline std::shared_ptr<ChannelCredentials> SslCredentials( /// A channel credentials object encapsulates all the state needed by a client
const SslCredentialsOptions& options) { /// to authenticate with a server for a given channel.
return ::grpc_impl::SslCredentials(options); /// It can make various assertions, e.g., about the client’s identity, role
} /// for all the calls on that channel.
///
/// \see https://grpc.io/docs/guides/auth.html
class ChannelCredentials : private grpc::GrpcLibraryCodegen {
public:
ChannelCredentials();
~ChannelCredentials();
static inline std::shared_ptr<grpc_impl::CallCredentials> protected:
GoogleComputeEngineCredentials() { friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
return ::grpc_impl::GoogleComputeEngineCredentials(); const std::shared_ptr<ChannelCredentials>& channel_creds,
} const std::shared_ptr<CallCredentials>& call_creds);
/// Constant for maximum auth token lifetime. virtual SecureChannelCredentials* AsSecureCredentials() = 0;
constexpr long kMaxAuthTokenLifetimeSecs =
::grpc_impl::kMaxAuthTokenLifetimeSecs;
static inline std::shared_ptr<grpc_impl::CallCredentials> private:
ServiceAccountJWTAccessCredentials( friend std::shared_ptr<grpc::Channel> CreateCustomChannel(
const std::string& json_key, const grpc::string& target,
long token_lifetime_seconds = grpc::kMaxAuthTokenLifetimeSecs) { const std::shared_ptr<grpc::ChannelCredentials>& creds,
return ::grpc_impl::ServiceAccountJWTAccessCredentials( const grpc::ChannelArguments& args);
json_key, token_lifetime_seconds);
}
static inline std::shared_ptr<grpc_impl::CallCredentials> friend std::shared_ptr<grpc::Channel>
GoogleRefreshTokenCredentials(const std::string& json_refresh_token) { grpc::experimental::CreateCustomChannelWithInterceptors(
return ::grpc_impl::GoogleRefreshTokenCredentials(json_refresh_token); const grpc::string& target,
} const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args,
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
static inline std::shared_ptr<grpc_impl::CallCredentials> virtual std::shared_ptr<Channel> CreateChannelImpl(
AccessTokenCredentials(const std::string& access_token) { const grpc::string& target, const ChannelArguments& args) = 0;
return ::grpc_impl::AccessTokenCredentials(access_token);
}
static inline std::shared_ptr<grpc_impl::CallCredentials> GoogleIAMCredentials( // This function should have been a pure virtual function, but it is
const std::string& authorization_token, // implemented as a virtual function so that it does not break API.
const std::string& authority_selector) { virtual std::shared_ptr<Channel> CreateChannelWithInterceptors(
return ::grpc_impl::GoogleIAMCredentials(authorization_token, const grpc::string& /*target*/, const ChannelArguments& /*args*/,
authority_selector); std::vector<std::unique_ptr<
} grpc::experimental::ClientInterceptorFactoryInterface>>
/*interceptor_creators*/) {
return nullptr;
}
};
/// A call credentials object encapsulates the state needed by a client to
/// authenticate with a server for a given call on a channel.
///
/// \see https://grpc.io/docs/guides/auth.html
class CallCredentials : private grpc::GrpcLibraryCodegen {
public:
CallCredentials();
~CallCredentials();
/// Apply this instance's credentials to \a call.
virtual bool ApplyToCall(grpc_call* call) = 0;
virtual grpc::string DebugString() {
return "CallCredentials did not provide a debug string";
}
protected:
friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
friend std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds1,
const std::shared_ptr<CallCredentials>& creds2);
virtual SecureCallCredentials* AsSecureCredentials() = 0;
};
/// Options used to build SslCredentials.
struct SslCredentialsOptions {
/// The buffer containing the PEM encoding of the server root certificates. If
/// this parameter is empty, the default roots will be used. The default
/// roots can be overridden using the \a GRPC_DEFAULT_SSL_ROOTS_FILE_PATH
/// environment variable pointing to a file on the file system containing the
/// roots.
grpc::string pem_root_certs;
/// The buffer containing the PEM encoding of the client's private key. This
/// parameter can be empty if the client does not have a private key.
grpc::string pem_private_key;
/// The buffer containing the PEM encoding of the client's certificate chain.
/// This parameter can be empty if the client does not have a certificate
/// chain.
grpc::string pem_cert_chain;
};
// Factories for building different types of Credentials The functions may
// return empty shared_ptr when credentials cannot be created. If a
// Credentials pointer is returned, it can still be invalid when used to create
// a channel. A lame channel will be created then and all rpcs will fail on it.
/// Builds credentials with reasonable defaults.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials();
/// Builds SSL Credentials given SSL specific options
std::shared_ptr<ChannelCredentials> SslCredentials(
const SslCredentialsOptions& options);
/// Builds credentials for use when running in GCE
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials();
static inline std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( constexpr long kMaxAuthTokenLifetimeSecs = 3600;
/// Builds Service Account JWT Access credentials.
/// json_key is the JSON key string containing the client's private key.
/// token_lifetime_seconds is the lifetime in seconds of each Json Web Token
/// (JWT) created with this credentials. It should not exceed
/// \a kMaxAuthTokenLifetimeSecs or will be cropped to this value.
std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
const grpc::string& json_key,
long token_lifetime_seconds = kMaxAuthTokenLifetimeSecs);
/// Builds refresh token credentials.
/// json_refresh_token is the JSON string containing the refresh token along
/// with a client_id and client_secret.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
const grpc::string& json_refresh_token);
/// Builds access token credentials.
/// access_token is an oauth2 access token that was fetched using an out of band
/// mechanism.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> AccessTokenCredentials(
const grpc::string& access_token);
/// Builds IAM credentials.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleIAMCredentials(
const grpc::string& authorization_token,
const grpc::string& authority_selector);
/// Combines a channel credentials and a call credentials into a composite
/// channel credentials.
std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds, const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds) { const std::shared_ptr<CallCredentials>& call_creds);
return ::grpc_impl::CompositeChannelCredentials(channel_creds, call_creds);
}
static inline std::shared_ptr<grpc_impl::CallCredentials> /// Combines two call credentials objects into a composite call credentials.
CompositeCallCredentials(const std::shared_ptr<CallCredentials>& creds1, std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds2) { const std::shared_ptr<CallCredentials>& creds1,
return ::grpc_impl::CompositeCallCredentials(creds1, creds2); const std::shared_ptr<CallCredentials>& creds2);
}
static inline std::shared_ptr<grpc_impl::ChannelCredentials> /// Credentials for an unencrypted, unauthenticated channel
InsecureChannelCredentials() { std::shared_ptr<ChannelCredentials> InsecureChannelCredentials();
return ::grpc_impl::InsecureChannelCredentials();
}
typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin; /// User defined metadata credentials.
class MetadataCredentialsPlugin {
public:
virtual ~MetadataCredentialsPlugin() {}
static inline std::shared_ptr<grpc_impl::CallCredentials> /// If this method returns true, the Process function will be scheduled in
MetadataCredentialsFromPlugin( /// a different thread from the one processing the call.
std::unique_ptr<MetadataCredentialsPlugin> plugin) { virtual bool IsBlocking() const { return true; }
return ::grpc_impl::MetadataCredentialsFromPlugin(std::move(plugin));
} /// Type of credentials this plugin is implementing.
virtual const char* GetType() const { return ""; }
/// Gets the auth metatada produced by this plugin.
/// The fully qualified method name is:
/// service_url + "/" + method_name.
/// The channel_auth_context contains (among other things), the identity of
/// the server.
virtual grpc::Status GetMetadata(
grpc::string_ref service_url, grpc::string_ref method_name,
const grpc::AuthContext& channel_auth_context,
std::multimap<grpc::string, grpc::string>* metadata) = 0;
virtual grpc::string DebugString() {
return "MetadataCredentialsPlugin did not provide a debug string";
}
};
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin);
namespace experimental { namespace experimental {
typedef ::grpc_impl::experimental::StsCredentialsOptions StsCredentialsOptions; /// Options for creating STS Oauth Token Exchange credentials following the IETF
/// draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.
/// Optional fields may be set to empty string. It is the responsibility of the
/// caller to ensure that the subject and actor tokens are refreshed on disk at
/// the specified paths.
struct StsCredentialsOptions {
grpc::string token_exchange_service_uri; // Required.
grpc::string resource; // Optional.
grpc::string audience; // Optional.
grpc::string scope; // Optional.
grpc::string requested_token_type; // Optional.
grpc::string subject_token_path; // Required.
grpc::string subject_token_type; // Required.
grpc::string actor_token_path; // Optional.
grpc::string actor_token_type; // Optional.
};
static inline grpc::Status StsCredentialsOptionsFromJson( grpc::Status StsCredentialsOptionsFromJson(const std::string& json_string,
const std::string& json_string, StsCredentialsOptions* options) { StsCredentialsOptions* options);
return ::grpc_impl::experimental::StsCredentialsOptionsFromJson(json_string,
options);
}
static inline grpc::Status StsCredentialsOptionsFromEnv( /// Creates STS credentials options from the $STS_CREDENTIALS environment
StsCredentialsOptions* options) { /// variable. This environment variable points to the path of a JSON file
return grpc_impl::experimental::StsCredentialsOptionsFromEnv(options); /// comforming to the schema described above.
} grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options);
static inline std::shared_ptr<grpc_impl::CallCredentials> StsCredentials( std::shared_ptr<CallCredentials> StsCredentials(
const StsCredentialsOptions& options) { const StsCredentialsOptions& options);
return grpc_impl::experimental::StsCredentials(options);
}
typedef ::grpc_impl::experimental::AltsCredentialsOptions std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
AltsCredentialsOptions; std::unique_ptr<MetadataCredentialsPlugin> plugin,
grpc_security_level min_security_level);
static inline std::shared_ptr<grpc_impl::ChannelCredentials> AltsCredentials( /// Options used to build AltsCredentials.
const AltsCredentialsOptions& options) { struct AltsCredentialsOptions {
return ::grpc_impl::experimental::AltsCredentials(options); /// service accounts of target endpoint that will be acceptable
} /// by the client. If service accounts are provided and none of them matches
/// that of the server, authentication will fail.
std::vector<grpc::string> target_service_accounts;
};
static inline std::shared_ptr<grpc_impl::ChannelCredentials> LocalCredentials( /// Builds ALTS Credentials given ALTS specific options
grpc_local_connect_type type) { std::shared_ptr<ChannelCredentials> AltsCredentials(
return ::grpc_impl::experimental::LocalCredentials(type); const AltsCredentialsOptions& options);
}
static inline std::shared_ptr<grpc_impl::ChannelCredentials> TlsCredentials( /// Builds Local Credentials.
const ::grpc_impl::experimental::TlsCredentialsOptions& options) { std::shared_ptr<ChannelCredentials> LocalCredentials(
return ::grpc_impl::experimental::TlsCredentials(options); grpc_local_connect_type type);
}
/// Builds TLS Credentials given TLS options.
std::shared_ptr<ChannelCredentials> TlsCredentials(
const TlsCredentialsOptions& options);
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -1,356 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_SECURITY_CREDENTIALS_IMPL_H
#define GRPCPP_SECURITY_CREDENTIALS_IMPL_H
#include <map>
#include <memory>
#include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpcpp/channel_impl.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/security/auth_context.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/channel_arguments_impl.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
struct grpc_call;
namespace grpc_impl {
class ChannelCredentials;
class CallCredentials;
class SecureCallCredentials;
class SecureChannelCredentials;
std::shared_ptr<Channel> CreateCustomChannelImpl(
const std::string& target, const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args);
namespace experimental {
std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
const std::string& target, const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args,
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
}
/// A channel credentials object encapsulates all the state needed by a client
/// to authenticate with a server for a given channel.
/// It can make various assertions, e.g., about the client’s identity, role
/// for all the calls on that channel.
///
/// \see https://grpc.io/docs/guides/auth
class ChannelCredentials : private grpc::GrpcLibraryCodegen {
public:
ChannelCredentials();
~ChannelCredentials();
protected:
friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
virtual SecureChannelCredentials* AsSecureCredentials() = 0;
private:
friend std::shared_ptr<Channel> CreateCustomChannelImpl(
const std::string& target,
const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args);
friend std::shared_ptr<Channel>
grpc_impl::experimental::CreateCustomChannelWithInterceptors(
const std::string& target,
const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args,
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
virtual std::shared_ptr<Channel> CreateChannelImpl(
const std::string& target, const ChannelArguments& args) = 0;
// This function should have been a pure virtual function, but it is
// implemented as a virtual function so that it does not break API.
virtual std::shared_ptr<Channel> CreateChannelWithInterceptors(
const std::string& /*target*/, const ChannelArguments& /*args*/,
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
/*interceptor_creators*/) {
return nullptr;
}
};
/// A call credentials object encapsulates the state needed by a client to
/// authenticate with a server for a given call on a channel.
///
/// \see https://grpc.io/docs/guides/auth
class CallCredentials : private grpc::GrpcLibraryCodegen {
public:
CallCredentials();
~CallCredentials();
/// Apply this instance's credentials to \a call.
virtual bool ApplyToCall(grpc_call* call) = 0;
virtual std::string DebugString() {
return "CallCredentials did not provide a debug string";
}
protected:
friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
friend std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds1,
const std::shared_ptr<CallCredentials>& creds2);
virtual SecureCallCredentials* AsSecureCredentials() = 0;
};
/// Options used to build SslCredentials.
struct SslCredentialsOptions {
/// The buffer containing the PEM encoding of the server root certificates. If
/// this parameter is empty, the default roots will be used. The default
/// roots can be overridden using the \a GRPC_DEFAULT_SSL_ROOTS_FILE_PATH
/// environment variable pointing to a file on the file system containing the
/// roots.
std::string pem_root_certs;
/// The buffer containing the PEM encoding of the client's private key. This
/// parameter can be empty if the client does not have a private key.
std::string pem_private_key;
/// The buffer containing the PEM encoding of the client's certificate chain.
/// This parameter can be empty if the client does not have a certificate
/// chain.
std::string pem_cert_chain;
};
// Factories for building different types of Credentials The functions may
// return empty shared_ptr when credentials cannot be created. If a
// Credentials pointer is returned, it can still be invalid when used to create
// a channel. A lame channel will be created then and all rpcs will fail on it.
/// Builds credentials with reasonable defaults.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials();
/// Builds SSL Credentials given SSL specific options
std::shared_ptr<ChannelCredentials> SslCredentials(
const SslCredentialsOptions& options);
/// Builds credentials for use when running in GCE
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials();
constexpr long kMaxAuthTokenLifetimeSecs = 3600;
/// Builds Service Account JWT Access credentials.
/// json_key is the JSON key string containing the client's private key.
/// token_lifetime_seconds is the lifetime in seconds of each Json Web Token
/// (JWT) created with this credentials. It should not exceed
/// \a kMaxAuthTokenLifetimeSecs or will be cropped to this value.
std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
const std::string& json_key,
long token_lifetime_seconds = grpc_impl::kMaxAuthTokenLifetimeSecs);
/// Builds refresh token credentials.
/// json_refresh_token is the JSON string containing the refresh token along
/// with a client_id and client_secret.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
const std::string& json_refresh_token);
/// Builds access token credentials.
/// access_token is an oauth2 access token that was fetched using an out of band
/// mechanism.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> AccessTokenCredentials(
const std::string& access_token);
/// Builds IAM credentials.
///
/// \warning Only use these credentials when connecting to a Google endpoint.
/// Using these credentials to connect to any other service may result in this
/// service being able to impersonate your client for requests to Google
/// services.
std::shared_ptr<CallCredentials> GoogleIAMCredentials(
const std::string& authorization_token,
const std::string& authority_selector);
/// Combines a channel credentials and a call credentials into a composite
/// channel credentials.
std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
/// Combines two call credentials objects into a composite call credentials.
std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds1,
const std::shared_ptr<CallCredentials>& creds2);
/// Credentials for an unencrypted, unauthenticated channel
std::shared_ptr<ChannelCredentials> InsecureChannelCredentials();
/// User defined metadata credentials.
class MetadataCredentialsPlugin {
public:
virtual ~MetadataCredentialsPlugin() {}
/// If this method returns true, the Process function will be scheduled in
/// a different thread from the one processing the call.
virtual bool IsBlocking() const { return true; }
/// Type of credentials this plugin is implementing.
virtual const char* GetType() const { return ""; }
/// Gets the auth metatada produced by this plugin.
/// The fully qualified method name is:
/// service_url + "/" + method_name.
/// The channel_auth_context contains (among other things), the identity of
/// the server.
virtual grpc::Status GetMetadata(
grpc::string_ref service_url, grpc::string_ref method_name,
const grpc::AuthContext& channel_auth_context,
std::multimap<std::string, std::string>* metadata) = 0;
virtual std::string DebugString() {
return "MetadataCredentialsPlugin did not provide a debug string";
}
};
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin);
namespace experimental {
/// Options for creating STS Oauth Token Exchange credentials following the IETF
/// draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.
/// Optional fields may be set to empty string. It is the responsibility of the
/// caller to ensure that the subject and actor tokens are refreshed on disk at
/// the specified paths.
struct StsCredentialsOptions {
std::string token_exchange_service_uri; // Required.
std::string resource; // Optional.
std::string audience; // Optional.
std::string scope; // Optional.
std::string requested_token_type; // Optional.
std::string subject_token_path; // Required.
std::string subject_token_type; // Required.
std::string actor_token_path; // Optional.
std::string actor_token_type; // Optional.
};
/// Creates STS Options from a JSON string. The JSON schema is as follows:
/// {
/// "title": "STS Credentials Config",
/// "type": "object",
/// "required": ["token_exchange_service_uri", "subject_token_path",
/// "subject_token_type"],
/// "properties": {
/// "token_exchange_service_uri": {
/// "type": "string"
/// },
/// "resource": {
/// "type": "string"
/// },
/// "audience": {
/// "type": "string"
/// },
/// "scope": {
/// "type": "string"
/// },
/// "requested_token_type": {
/// "type": "string"
/// },
/// "subject_token_path": {
/// "type": "string"
/// },
/// "subject_token_type": {
/// "type": "string"
/// },
/// "actor_token_path" : {
/// "type": "string"
/// },
/// "actor_token_type": {
/// "type": "string"
/// }
/// }
/// }
grpc::Status StsCredentialsOptionsFromJson(const std::string& json_string,
StsCredentialsOptions* options);
/// Creates STS credentials options from the $STS_CREDENTIALS environment
/// variable. This environment variable points to the path of a JSON file
/// comforming to the schema described above.
grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options);
std::shared_ptr<CallCredentials> StsCredentials(
const StsCredentialsOptions& options);
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin,
grpc_security_level min_security_level);
/// Options used to build AltsCredentials.
struct AltsCredentialsOptions {
/// service accounts of target endpoint that will be acceptable
/// by the client. If service accounts are provided and none of them matches
/// that of the server, authentication will fail.
std::vector<std::string> target_service_accounts;
};
/// Builds ALTS Credentials given ALTS specific options
std::shared_ptr<ChannelCredentials> AltsCredentials(
const AltsCredentialsOptions& options);
/// Builds Local Credentials.
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type);
/// Builds TLS Credentials given TLS options.
std::shared_ptr<ChannelCredentials> TlsCredentials(
const TlsCredentialsOptions& options);
} // namespace experimental
} // namespace grpc_impl
#endif // GRPCPP_SECURITY_CREDENTIALS_IMPL_H

@ -23,10 +23,7 @@
namespace grpc { namespace grpc {
static inline std::shared_ptr<grpc_impl::ChannelCredentials> std::shared_ptr<ChannelCredentials> CronetChannelCredentials(void* engine);
CronetChannelCredentials(void* engine) {
return ::grpc_impl::CronetChannelCredentials(engine);
}
} // namespace grpc } // namespace grpc

@ -55,35 +55,25 @@ struct SslServerCredentialsOptions {
grpc_ssl_client_certificate_request_type client_certificate_request; grpc_ssl_client_certificate_request_type client_certificate_request;
}; };
static inline std::shared_ptr<ServerCredentials> SslServerCredentials( std::shared_ptr<ServerCredentials> SslServerCredentials(
const SslServerCredentialsOptions& options) { const SslServerCredentialsOptions& options);
return ::grpc_impl::SslServerCredentials(options);
}
static inline std::shared_ptr<ServerCredentials> InsecureServerCredentials() { std::shared_ptr<ServerCredentials> InsecureServerCredentials();
return ::grpc_impl::InsecureServerCredentials();
}
namespace experimental { namespace experimental {
typedef ::grpc_impl::experimental::AltsServerCredentialsOptions typedef ::grpc_impl::experimental::AltsServerCredentialsOptions
AltsServerCredentialsOptions; AltsServerCredentialsOptions;
static inline std::shared_ptr<ServerCredentials> AltsServerCredentials( std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& options) { const AltsServerCredentialsOptions& options);
return ::grpc_impl::experimental::AltsServerCredentials(options);
}
static inline std::shared_ptr<ServerCredentials> LocalServerCredentials( std::shared_ptr<ServerCredentials> LocalServerCredentials(
grpc_local_connect_type type) { grpc_local_connect_type type);
return ::grpc_impl::experimental::LocalServerCredentials(type);
}
/// Builds TLS ServerCredentials given TLS options. /// Builds TLS ServerCredentials given TLS options.
static inline std::shared_ptr<ServerCredentials> TlsServerCredentials( std::shared_ptr<ServerCredentials> TlsServerCredentials(
const ::grpc_impl::experimental::TlsCredentialsOptions& options) { const ::grpc::experimental::TlsCredentialsOptions& options);
return ::grpc_impl::experimental::TlsServerCredentials(options);
}
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -81,7 +81,7 @@ std::shared_ptr<ServerCredentials> LocalServerCredentials(
/// Builds TLS ServerCredentials given TLS options. /// Builds TLS ServerCredentials given TLS options.
std::shared_ptr<ServerCredentials> TlsServerCredentials( std::shared_ptr<ServerCredentials> TlsServerCredentials(
const TlsCredentialsOptions& options); const grpc::experimental::TlsCredentialsOptions& options);
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc_impl

@ -36,7 +36,7 @@ typedef struct grpc_tls_server_authorization_check_config
grpc_tls_server_authorization_check_config; grpc_tls_server_authorization_check_config;
typedef struct grpc_tls_credentials_options grpc_tls_credentials_options; typedef struct grpc_tls_credentials_options grpc_tls_credentials_options;
namespace grpc_impl { namespace grpc {
namespace experimental { namespace experimental {
/** TLS key materials config, wrapper for grpc_tls_key_materials_config. It is /** TLS key materials config, wrapper for grpc_tls_key_materials_config. It is
@ -340,6 +340,6 @@ class TlsCredentialsOptions {
}; };
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc
#endif // GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H #endif // GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H

@ -28,6 +28,7 @@
#include <grpcpp/support/config.h> #include <grpcpp/support/config.h>
namespace grpc { namespace grpc {
class SecureChannelCredentials;
namespace testing { namespace testing {
class ChannelArgumentsTest; class ChannelArgumentsTest;
} // namespace testing } // namespace testing
@ -35,8 +36,6 @@ class ChannelArgumentsTest;
namespace grpc_impl { namespace grpc_impl {
class SecureChannelCredentials;
/// Options for channel creation. The user can use generic setters to pass /// Options for channel creation. The user can use generic setters to pass
/// key value pairs down to C channel creation code. For gRPC related options, /// key value pairs down to C channel creation code. For gRPC related options,
/// concrete setters are provided. /// concrete setters are provided.
@ -126,7 +125,7 @@ class ChannelArguments {
} }
private: private:
friend class grpc_impl::SecureChannelCredentials; friend class grpc::SecureChannelCredentials;
friend class grpc::testing::ChannelArgumentsTest; friend class grpc::testing::ChannelArgumentsTest;
/// Default pointer argument operations. /// Default pointer argument operations.

@ -73,7 +73,7 @@ ClientContext::~ClientContext() {
} }
void ClientContext::set_credentials( void ClientContext::set_credentials(
const std::shared_ptr<grpc_impl::CallCredentials>& creds) { const std::shared_ptr<grpc::CallCredentials>& creds) {
creds_ = creds; creds_ = creds;
// If call_ is set, we have already created the call, and set the call // If call_ is set, we have already created the call, and set the call
// credentials. This should only be done before we have started the batch // credentials. This should only be done before we have started the batch

@ -26,15 +26,15 @@
#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/create_channel_internal.h"
namespace grpc_impl { namespace grpc {
std::shared_ptr<grpc::Channel> CreateChannelImpl( std::shared_ptr<grpc::Channel> CreateChannel(
const std::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds) { const std::shared_ptr<grpc::ChannelCredentials>& creds) {
return CreateCustomChannelImpl(target, creds, grpc::ChannelArguments()); return CreateCustomChannel(target, creds, grpc::ChannelArguments());
} }
std::shared_ptr<grpc::Channel> CreateCustomChannelImpl( std::shared_ptr<grpc::Channel> CreateCustomChannel(
const std::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds, const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args) { const grpc::ChannelArguments& args) {
grpc::GrpcLibraryCodegen grpc::GrpcLibraryCodegen
@ -82,4 +82,4 @@ std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
} }
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc

@ -19,7 +19,7 @@
#include <grpcpp/impl/grpc_library.h> #include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h> #include <grpcpp/security/credentials.h>
namespace grpc_impl { namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer; static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); } ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
@ -30,4 +30,4 @@ CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
CallCredentials::~CallCredentials() {} CallCredentials::~CallCredentials() {}
} // namespace grpc_impl } // namespace grpc

@ -55,10 +55,9 @@ class CronetChannelCredentialsImpl final : public ChannelCredentials {
} }
void* engine_; void* engine_;
}; };
} // namespace grpc
namespace grpc_impl {
std::shared_ptr<ChannelCredentials> CronetChannelCredentials(void* engine) { std::shared_ptr<ChannelCredentials> CronetChannelCredentials(void* engine) {
return std::shared_ptr<ChannelCredentials>( return std::shared_ptr<ChannelCredentials>(
new grpc::CronetChannelCredentialsImpl(engine)); new grpc::CronetChannelCredentialsImpl(engine));
} }
} // namespace grpc_impl } // namespace grpc

@ -24,7 +24,7 @@
#include <grpcpp/support/config.h> #include <grpcpp/support/config.h>
#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/create_channel_internal.h"
namespace grpc_impl { namespace grpc {
namespace { namespace {
class InsecureChannelCredentialsImpl final : public ChannelCredentials { class InsecureChannelCredentialsImpl final : public ChannelCredentials {
@ -59,4 +59,4 @@ std::shared_ptr<ChannelCredentials> InsecureChannelCredentials() {
new InsecureChannelCredentialsImpl()); new InsecureChannelCredentialsImpl());
} }
} // namespace grpc_impl } // namespace grpc

@ -38,7 +38,7 @@
#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/create_channel_internal.h"
#include "src/cpp/common/secure_auth_context.h" #include "src/cpp/common/secure_auth_context.h"
namespace grpc_impl { namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer; static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
SecureChannelCredentials::SecureChannelCredentials( SecureChannelCredentials::SecureChannelCredentials(
@ -388,9 +388,6 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
c_plugin, GRPC_PRIVACY_AND_INTEGRITY, nullptr)); c_plugin, GRPC_PRIVACY_AND_INTEGRITY, nullptr));
} }
} // namespace grpc_impl
namespace grpc {
namespace { namespace {
void DeleteWrapper(void* wrapper, grpc_error* /*ignored*/) { void DeleteWrapper(void* wrapper, grpc_error* /*ignored*/) {
MetadataCredentialsPluginWrapper* w = MetadataCredentialsPluginWrapper* w =

@ -22,7 +22,6 @@
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
#include <grpcpp/security/credentials.h> #include <grpcpp/security/credentials.h>
#include <grpcpp/security/credentials_impl.h>
#include <grpcpp/security/tls_credentials_options.h> #include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/config.h> #include <grpcpp/support/config.h>
@ -33,6 +32,9 @@
namespace grpc_impl { namespace grpc_impl {
class Channel; class Channel;
} // namespace grpc_impl
namespace grpc {
class SecureChannelCredentials final : public ChannelCredentials { class SecureChannelCredentials final : public ChannelCredentials {
public: public:
@ -85,10 +87,6 @@ grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
} // namespace experimental } // namespace experimental
} // namespace grpc_impl
namespace grpc {
class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen { class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
public: public:
static void Destroy(void* wrapper); static void Destroy(void* wrapper);

@ -23,7 +23,7 @@
#include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
#include "src/cpp/common/tls_credentials_options_util.h" #include "src/cpp/common/tls_credentials_options_util.h"
namespace grpc_impl { namespace grpc {
namespace experimental { namespace experimental {
/** TLS key materials config API implementation **/ /** TLS key materials config API implementation **/
@ -340,4 +340,4 @@ TlsCredentialsOptions::TlsCredentialsOptions(
TlsCredentialsOptions::~TlsCredentialsOptions() {} TlsCredentialsOptions::~TlsCredentialsOptions() {}
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc

@ -21,7 +21,7 @@
#include <grpcpp/security/tls_credentials_options.h> #include <grpcpp/security/tls_credentials_options.h>
#include "src/cpp/common/tls_credentials_options_util.h" #include "src/cpp/common/tls_credentials_options_util.h"
namespace grpc_impl { namespace grpc {
namespace experimental { namespace experimental {
/** Converts the Cpp key materials to C key materials; this allocates memory for /** Converts the Cpp key materials to C key materials; this allocates memory for
@ -146,4 +146,4 @@ void TlsServerAuthorizationCheckArgDestroyContext(void* context) {
} }
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc

@ -24,7 +24,7 @@
#include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
namespace grpc_impl { namespace grpc {
namespace experimental { namespace experimental {
/** The following function is exposed for testing purposes. **/ /** The following function is exposed for testing purposes. **/
@ -53,6 +53,6 @@ void TlsCredentialReloadArgDestroyContext(void* context);
void TlsServerAuthorizationCheckArgDestroyContext(void* context); void TlsServerAuthorizationCheckArgDestroyContext(void* context);
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc
#endif // GRPC_INTERNAL_CPP_COMMON_TLS_CREDENTIALS_OPTIONS_UTIL_H #endif // GRPC_INTERNAL_CPP_COMMON_TLS_CREDENTIALS_OPTIONS_UTIL_H

@ -21,7 +21,7 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
namespace grpc_impl { namespace grpc {
namespace { namespace {
class InsecureServerCredentialsImpl final : public ServerCredentials { class InsecureServerCredentialsImpl final : public ServerCredentials {
public: public:
@ -41,4 +41,4 @@ std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
new InsecureServerCredentialsImpl()); new InsecureServerCredentialsImpl());
} }
} // namespace grpc_impl } // namespace grpc

@ -94,7 +94,7 @@ void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
} // namespace grpc } // namespace grpc
namespace grpc_impl { namespace grpc {
int SecureServerCredentials::AddPortToServer(const std::string& addr, int SecureServerCredentials::AddPortToServer(const std::string& addr,
grpc_server* server) { grpc_server* server) {
@ -149,11 +149,11 @@ std::shared_ptr<ServerCredentials> LocalServerCredentials(
} }
std::shared_ptr<ServerCredentials> TlsServerCredentials( std::shared_ptr<ServerCredentials> TlsServerCredentials(
const TlsCredentialsOptions& options) { const grpc::experimental::TlsCredentialsOptions& options) {
grpc::GrpcLibraryCodegen init; grpc::GrpcLibraryCodegen init;
return std::shared_ptr<ServerCredentials>(new SecureServerCredentials( return std::shared_ptr<ServerCredentials>(new SecureServerCredentials(
grpc_tls_server_credentials_create(options.c_credentials_options()))); grpc_tls_server_credentials_create(options.c_credentials_options())));
} }
} // namespace experimental } // namespace experimental
} // namespace grpc_impl } // namespace grpc

@ -28,14 +28,9 @@
#include "src/cpp/server/thread_pool_interface.h" #include "src/cpp/server/thread_pool_interface.h"
namespace grpc_impl {
class SecureServerCredentials;
} // namespace grpc_impl
namespace grpc { namespace grpc {
typedef ::grpc_impl::SecureServerCredentials SecureServerCredentials; class SecureServerCredentials;
class AuthMetadataProcessorAyncWrapper final { class AuthMetadataProcessorAyncWrapper final {
public: public:
@ -61,10 +56,6 @@ class AuthMetadataProcessorAyncWrapper final {
std::shared_ptr<AuthMetadataProcessor> processor_; std::shared_ptr<AuthMetadataProcessor> processor_;
}; };
} // namespace grpc
namespace grpc_impl {
class SecureServerCredentials final : public ServerCredentials { class SecureServerCredentials final : public ServerCredentials {
public: public:
explicit SecureServerCredentials(grpc_server_credentials* creds) explicit SecureServerCredentials(grpc_server_credentials* creds)
@ -83,6 +74,6 @@ class SecureServerCredentials final : public ServerCredentials {
std::unique_ptr<grpc::AuthMetadataProcessorAyncWrapper> processor_; std::unique_ptr<grpc::AuthMetadataProcessorAyncWrapper> processor_;
}; };
} // namespace grpc_impl } // namespace grpc
#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H #endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H

@ -26,7 +26,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include "grpcpp/security/credentials_impl.h" #include "grpcpp/security/credentials.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/credentials.h"
@ -36,10 +36,9 @@
#include "test/core/util/cmdline.h" #include "test/core/util/cmdline.h"
static grpc_call_credentials* create_sts_creds(const char* json_file_path) { static grpc_call_credentials* create_sts_creds(const char* json_file_path) {
grpc_impl::experimental::StsCredentialsOptions options; grpc::experimental::StsCredentialsOptions options;
if (strlen(json_file_path) == 0) { if (strlen(json_file_path) == 0) {
auto status = auto status = grpc::experimental::StsCredentialsOptionsFromEnv(&options);
grpc_impl::experimental::StsCredentialsOptionsFromEnv(&options);
if (!status.ok()) { if (!status.ok()) {
gpr_log(GPR_ERROR, "%s", status.error_message().c_str()); gpr_log(GPR_ERROR, "%s", status.error_message().c_str());
return nullptr; return nullptr;
@ -48,7 +47,7 @@ static grpc_call_credentials* create_sts_creds(const char* json_file_path) {
grpc_slice sts_options_slice; grpc_slice sts_options_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR( GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(json_file_path, 1, &sts_options_slice))); "load_file", grpc_load_file(json_file_path, 1, &sts_options_slice)));
auto status = grpc_impl::experimental::StsCredentialsOptionsFromJson( auto status = grpc::experimental::StsCredentialsOptionsFromJson(
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(sts_options_slice)), reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(sts_options_slice)),
&options); &options);
gpr_slice_unref(sts_options_slice); gpr_slice_unref(sts_options_slice);
@ -58,7 +57,7 @@ static grpc_call_credentials* create_sts_creds(const char* json_file_path) {
} }
} }
grpc_sts_credentials_options opts = grpc_sts_credentials_options opts =
grpc_impl::experimental::StsCredentialsCppToCoreOptions(options); grpc::experimental::StsCredentialsCppToCoreOptions(options);
grpc_call_credentials* result = grpc_sts_credentials_create(&opts, nullptr); grpc_call_credentials* result = grpc_sts_credentials_create(&opts, nullptr);
return result; return result;
} }

@ -34,15 +34,14 @@
namespace { namespace {
typedef class ::grpc_impl::experimental::TlsKeyMaterialsConfig typedef class ::grpc::experimental::TlsKeyMaterialsConfig TlsKeyMaterialsConfig;
TlsKeyMaterialsConfig; typedef class ::grpc::experimental::TlsCredentialReloadArg
typedef class ::grpc_impl::experimental::TlsCredentialReloadArg
TlsCredentialReloadArg; TlsCredentialReloadArg;
typedef struct ::grpc_impl::experimental::TlsCredentialReloadInterface typedef struct ::grpc::experimental::TlsCredentialReloadInterface
TlsCredentialReloadInterface; TlsCredentialReloadInterface;
typedef class ::grpc_impl::experimental::TlsServerAuthorizationCheckArg typedef class ::grpc::experimental::TlsServerAuthorizationCheckArg
TlsServerAuthorizationCheckArg; TlsServerAuthorizationCheckArg;
typedef struct ::grpc_impl::experimental::TlsServerAuthorizationCheckInterface typedef struct ::grpc::experimental::TlsServerAuthorizationCheckInterface
TlsServerAuthorizationCheckInterface; TlsServerAuthorizationCheckInterface;
static void tls_credential_reload_callback( static void tls_credential_reload_callback(
@ -131,7 +130,7 @@ TEST_F(CredentialsTest, StsCredentialsOptionsCppToCore) {
options.actor_token_path = "/foo/baz"; options.actor_token_path = "/foo/baz";
options.actor_token_type = "even_nicer_token_type"; options.actor_token_type = "even_nicer_token_type";
grpc_sts_credentials_options core_opts = grpc_sts_credentials_options core_opts =
grpc_impl::experimental::StsCredentialsCppToCoreOptions(options); grpc::experimental::StsCredentialsCppToCoreOptions(options);
EXPECT_EQ(options.token_exchange_service_uri, EXPECT_EQ(options.token_exchange_service_uri,
core_opts.token_exchange_service_uri); core_opts.token_exchange_service_uri);
EXPECT_EQ(options.resource, core_opts.resource); EXPECT_EQ(options.resource, core_opts.resource);
@ -271,8 +270,7 @@ TEST_F(CredentialsTest, StsCredentialsOptionsFromEnv) {
gpr_unsetenv("STS_CREDENTIALS"); gpr_unsetenv("STS_CREDENTIALS");
} }
typedef class ::grpc_impl::experimental::TlsKeyMaterialsConfig typedef class ::grpc::experimental::TlsKeyMaterialsConfig TlsKeyMaterialsConfig;
TlsKeyMaterialsConfig;
TEST_F(CredentialsTest, TlsKeyMaterialsConfigCppToC) { TEST_F(CredentialsTest, TlsKeyMaterialsConfigCppToC) {
std::shared_ptr<TlsKeyMaterialsConfig> config(new TlsKeyMaterialsConfig()); std::shared_ptr<TlsKeyMaterialsConfig> config(new TlsKeyMaterialsConfig());
@ -304,9 +302,9 @@ TEST_F(CredentialsTest, TlsKeyMaterialsModifiers) {
EXPECT_STREQ(list[0].cert_chain.c_str(), "cert_chain"); EXPECT_STREQ(list[0].cert_chain.c_str(), "cert_chain");
} }
typedef class ::grpc_impl::experimental::TlsCredentialReloadArg typedef class ::grpc::experimental::TlsCredentialReloadArg
TlsCredentialReloadArg; TlsCredentialReloadArg;
typedef class ::grpc_impl::experimental::TlsCredentialReloadConfig typedef class ::grpc::experimental::TlsCredentialReloadConfig
TlsCredentialReloadConfig; TlsCredentialReloadConfig;
TEST_F(CredentialsTest, TlsCredentialReloadArgCallback) { TEST_F(CredentialsTest, TlsCredentialReloadArgCallback) {
@ -433,9 +431,9 @@ TEST_F(CredentialsTest, TlsCredentialReloadConfigCppToC) {
delete config.c_config(); delete config.c_config();
} }
typedef class ::grpc_impl::experimental::TlsServerAuthorizationCheckArg typedef class ::grpc::experimental::TlsServerAuthorizationCheckArg
TlsServerAuthorizationCheckArg; TlsServerAuthorizationCheckArg;
typedef class ::grpc_impl::experimental::TlsServerAuthorizationCheckConfig typedef class ::grpc::experimental::TlsServerAuthorizationCheckConfig
TlsServerAuthorizationCheckConfig; TlsServerAuthorizationCheckConfig;
TEST_F(CredentialsTest, TlsServerAuthorizationCheckArgCallback) { TEST_F(CredentialsTest, TlsServerAuthorizationCheckArgCallback) {
@ -550,8 +548,7 @@ TEST_F(CredentialsTest, TlsServerAuthorizationCheckConfigCppToC) {
delete config.c_config(); delete config.c_config();
} }
typedef class ::grpc_impl::experimental::TlsCredentialsOptions typedef class ::grpc::experimental::TlsCredentialsOptions TlsCredentialsOptions;
TlsCredentialsOptions;
TEST_F(CredentialsTest, TlsCredentialsOptionsCppToC) { TEST_F(CredentialsTest, TlsCredentialsOptionsCppToC) {
std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config( std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config(
@ -681,7 +678,7 @@ TEST_F(CredentialsTest, LoadTlsChannelCredentials) {
TlsCredentialsOptions options = TlsCredentialsOptions( TlsCredentialsOptions options = TlsCredentialsOptions(
GRPC_TLS_SERVER_VERIFICATION, nullptr, credential_reload_config, GRPC_TLS_SERVER_VERIFICATION, nullptr, credential_reload_config,
server_authorization_check_config); server_authorization_check_config);
std::shared_ptr<grpc_impl::ChannelCredentials> channel_credentials = std::shared_ptr<grpc::ChannelCredentials> channel_credentials =
grpc::experimental::TlsCredentials(options); grpc::experimental::TlsCredentials(options);
GPR_ASSERT(channel_credentials.get() != nullptr); GPR_ASSERT(channel_credentials.get() != nullptr);
} }

@ -940,7 +940,6 @@ include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/completion_queue_impl.h \ include/grpcpp/completion_queue_impl.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_impl.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
@ -1024,7 +1023,6 @@ include/grpcpp/resource_quota.h \
include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \ include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials.h \
include/grpcpp/security/credentials_impl.h \
include/grpcpp/security/server_credentials.h \ include/grpcpp/security/server_credentials.h \
include/grpcpp/security/server_credentials_impl.h \ include/grpcpp/security/server_credentials_impl.h \
include/grpcpp/security/tls_credentials_options.h \ include/grpcpp/security/tls_credentials_options.h \

@ -940,7 +940,6 @@ include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/completion_queue_impl.h \ include/grpcpp/completion_queue_impl.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_impl.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
@ -1024,7 +1023,6 @@ include/grpcpp/resource_quota.h \
include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \ include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials.h \
include/grpcpp/security/credentials_impl.h \
include/grpcpp/security/server_credentials.h \ include/grpcpp/security/server_credentials.h \
include/grpcpp/security/server_credentials_impl.h \ include/grpcpp/security/server_credentials_impl.h \
include/grpcpp/security/tls_credentials_options.h \ include/grpcpp/security/tls_credentials_options.h \

Loading…
Cancel
Save