diff options
author | 2016-02-24 14:17:26 -0800 | |
---|---|---|
committer | 2016-02-24 14:55:02 -0800 | |
commit | f30941cd95be22aa7108e2b0b14d657ab8c46856 (patch) | |
tree | 30b419539d6de0f457081c2a4ec2823c672dcfed /test/cpp/util/test_credentials_provider.h | |
parent | 24d309d281fbf29bcff0d47f38356a670dc07cd4 (diff) |
Injectable test credentials provider interface.
Diffstat (limited to 'test/cpp/util/test_credentials_provider.h')
-rw-r--r-- | test/cpp/util/test_credentials_provider.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cpp/util/test_credentials_provider.h b/test/cpp/util/test_credentials_provider.h index f7253051a9..a6b547cb07 100644 --- a/test/cpp/util/test_credentials_provider.h +++ b/test/cpp/util/test_credentials_provider.h @@ -44,6 +44,22 @@ namespace grpc { namespace testing { const char kInsecureCredentialsType[] = "INSECURE_CREDENTIALS"; +const char kTlsCredentialsType[] = "TLS_CREDENTIALS"; + +class CredentialsProvider { + public: + virtual ~CredentialsProvider() {} + + virtual std::shared_ptr<ChannelCredentials> GetChannelCredentials( + const grpc::string& type, ChannelArguments* args) = 0; + virtual std::shared_ptr<ServerCredentials> GetServerCredentials( + const grpc::string& type) = 0; + virtual std::vector<grpc::string> GetSecureCredentialsTypeList() = 0; +}; + +// Set the CredentialsProvider used by the other functions in this file. If this +// is not set, a default provider will be used. +void SetTestCredentialsProvider(std::unique_ptr<CredentialsProvider> provider); // Provide channel credentials according to the given type. Alter the channel // arguments if needed. |