From 2d041188db791ecd22739a3c87bb7f1e604b8845 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Mon, 31 Aug 2015 20:30:09 -0700 Subject: Design and implementation of the core credentials plugin API. - We use C++ as an example to show how this API can be used while still providing an idiomatic interface in the wrapped language of choice. - No testing yet. --- include/grpc++/security/credentials.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') diff --git a/include/grpc++/security/credentials.h b/include/grpc++/security/credentials.h index ce5a9e0606..03d3550197 100644 --- a/include/grpc++/security/credentials.h +++ b/include/grpc++/security/credentials.h @@ -34,10 +34,13 @@ #ifndef GRPCXX_CREDENTIALS_H #define GRPCXX_CREDENTIALS_H +#include #include #include #include +#include +#include namespace grpc { class ChannelArguments; @@ -129,6 +132,24 @@ std::shared_ptr CompositeCredentials( // Credentials for an unencrypted, unauthenticated channel std::shared_ptr InsecureCredentials(); +// 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; } + + // Gets the auth metatada produced by this plugin. */ + virtual Status GetMetadata( + grpc::string_ref service_url, + std::multimap* metadata) = 0; +}; + +std::shared_ptr MetadataCredentialsFromPlugin( + std::unique_ptr plugin); + } // namespace grpc #endif // GRPCXX_CREDENTIALS_H -- cgit v1.2.3