aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpp/common/auth_property_iterator.cc6
-rw-r--r--src/cpp/common/secure_auth_context.cc17
-rw-r--r--src/cpp/common/secure_auth_context.h6
3 files changed, 15 insertions, 14 deletions
diff --git a/src/cpp/common/auth_property_iterator.cc b/src/cpp/common/auth_property_iterator.cc
index 5ccf8cf72c..fa6da9d7a8 100644
--- a/src/cpp/common/auth_property_iterator.cc
+++ b/src/cpp/common/auth_property_iterator.cc
@@ -77,9 +77,9 @@ bool AuthPropertyIterator::operator!=(const AuthPropertyIterator& rhs) const {
}
const AuthProperty AuthPropertyIterator::operator*() {
- return std::make_pair<grpc::string, grpc::string>(
- grpc::string(property_->name),
- grpc::string(property_->value, property_->value_length));
+ return std::pair<grpc::string_ref, grpc::string_ref>(
+ property_->name,
+ grpc::string_ref(property_->value, property_->value_length));
}
} // namespace grpc
diff --git a/src/cpp/common/secure_auth_context.cc b/src/cpp/common/secure_auth_context.cc
index 87d7bab75c..b18a8537c9 100644
--- a/src/cpp/common/secure_auth_context.cc
+++ b/src/cpp/common/secure_auth_context.cc
@@ -41,15 +41,16 @@ SecureAuthContext::SecureAuthContext(grpc_auth_context* ctx) : ctx_(ctx) {}
SecureAuthContext::~SecureAuthContext() { grpc_auth_context_release(ctx_); }
-std::vector<grpc::string> SecureAuthContext::GetPeerIdentity() const {
+std::vector<grpc::string_ref> SecureAuthContext::GetPeerIdentity() const {
if (!ctx_) {
- return std::vector<grpc::string>();
+ return std::vector<grpc::string_ref>();
}
grpc_auth_property_iterator iter = grpc_auth_context_peer_identity(ctx_);
- std::vector<grpc::string> identity;
+ std::vector<grpc::string_ref> identity;
const grpc_auth_property* property = nullptr;
while ((property = grpc_auth_property_iterator_next(&iter))) {
- identity.push_back(grpc::string(property->value, property->value_length));
+ identity.push_back(
+ grpc::string_ref(property->value, property->value_length));
}
return identity;
}
@@ -62,17 +63,17 @@ grpc::string SecureAuthContext::GetPeerIdentityPropertyName() const {
return name == nullptr ? "" : name;
}
-std::vector<grpc::string> SecureAuthContext::FindPropertyValues(
+std::vector<grpc::string_ref> SecureAuthContext::FindPropertyValues(
const grpc::string& name) const {
if (!ctx_) {
- return std::vector<grpc::string>();
+ return std::vector<grpc::string_ref>();
}
grpc_auth_property_iterator iter =
grpc_auth_context_find_properties_by_name(ctx_, name.c_str());
const grpc_auth_property* property = nullptr;
- std::vector<grpc::string> values;
+ std::vector<grpc::string_ref> values;
while ((property = grpc_auth_property_iterator_next(&iter))) {
- values.push_back(grpc::string(property->value, property->value_length));
+ values.push_back(grpc::string_ref(property->value, property->value_length));
}
return values;
}
diff --git a/src/cpp/common/secure_auth_context.h b/src/cpp/common/secure_auth_context.h
index 01b7126189..7f622b890b 100644
--- a/src/cpp/common/secure_auth_context.h
+++ b/src/cpp/common/secure_auth_context.h
@@ -46,12 +46,12 @@ class SecureAuthContext GRPC_FINAL : public AuthContext {
~SecureAuthContext() GRPC_OVERRIDE;
- std::vector<grpc::string> GetPeerIdentity() const GRPC_OVERRIDE;
+ std::vector<grpc::string_ref> GetPeerIdentity() const GRPC_OVERRIDE;
grpc::string GetPeerIdentityPropertyName() const GRPC_OVERRIDE;
- std::vector<grpc::string> FindPropertyValues(const grpc::string& name) const
- GRPC_OVERRIDE;
+ std::vector<grpc::string_ref> FindPropertyValues(
+ const grpc::string& name) const GRPC_OVERRIDE;
AuthPropertyIterator begin() const GRPC_OVERRIDE;