diff options
author | 2015-08-10 12:45:17 -0700 | |
---|---|---|
committer | 2015-08-13 17:25:52 -0700 | |
commit | c2274e706937c1742e72a20a889ce1283d12af52 (patch) | |
tree | e33b3eb2b86119ed634c587e8bfb62ad1e7e1bfe /src/cpp/common/secure_auth_context.cc | |
parent | 8d428f1e6d0f7b76f8b737ae63f7a74b97279a1d (diff) |
Adding C++ auth metadata processor.
- We always do the processing asynchronously but maintain a synchronous
API for the implementor of the processor.
- there are a lot of string copies right now. Having a StringPiece
object in grpc++ would really help with that (as we would use it for
C++ metadata).
- Please review the API carefully and if you're happy with it, I'll
proceed with tests.
Diffstat (limited to 'src/cpp/common/secure_auth_context.cc')
-rw-r--r-- | src/cpp/common/secure_auth_context.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cpp/common/secure_auth_context.cc b/src/cpp/common/secure_auth_context.cc index 87d7bab75c..dc41083a48 100644 --- a/src/cpp/common/secure_auth_context.cc +++ b/src/cpp/common/secure_auth_context.cc @@ -93,4 +93,16 @@ AuthPropertyIterator SecureAuthContext::end() const { return AuthPropertyIterator(); } +void SecureAuthContext::AddProperty(const grpc::string& key, + const grpc::string& value) { + if (!ctx_) return; + grpc_auth_context_add_property(ctx_, key.c_str(), value.data(), value.size()); +} + +bool SecureAuthContext::SetPeerIdentityPropertyName(const grpc::string& name) { + if (!ctx_) return false; + return grpc_auth_context_set_peer_identity_property_name(ctx_, + name.c_str()) != 0; +} + } // namespace grpc |