aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-08-31 20:30:09 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2015-08-31 20:30:09 -0700
commit2d041188db791ecd22739a3c87bb7f1e604b8845 (patch)
tree39929b53ea6992c79d2859fd4003889663c51187 /include
parent29ee3f40beddc2d8a87e3946b9fd47fcb20785f9 (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/security/credentials.h21
1 files changed, 21 insertions, 0 deletions
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 <map>
#include <memory>
#include <grpc++/impl/grpc_library.h>
#include <grpc++/support/config.h>
+#include <grpc++/support/status.h>
+#include <grpc++/support/string_ref.h>
namespace grpc {
class ChannelArguments;
@@ -129,6 +132,24 @@ std::shared_ptr<Credentials> CompositeCredentials(
// Credentials for an unencrypted, unauthenticated channel
std::shared_ptr<Credentials> 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<grpc::string, grpc::string_ref>* metadata) = 0;
+};
+
+std::shared_ptr<Credentials> MetadataCredentialsFromPlugin(
+ std::unique_ptr<MetadataCredentialsPlugin> plugin);
+
} // namespace grpc
#endif // GRPCXX_CREDENTIALS_H