aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server/server_context.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp/server/server_context.cc')
-rw-r--r--src/cpp/server/server_context.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index 1bb3a8bcc4..3b8a026996 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -144,7 +144,7 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key,
trailing_metadata_.insert(std::make_pair(key, value));
}
-bool ServerContext::IsCancelled() {
+bool ServerContext::IsCancelled() const {
return completion_op_ && completion_op_->CheckCancelled(cq_);
}
@@ -153,4 +153,11 @@ void ServerContext::set_call(grpc_call* call) {
auth_context_ = CreateAuthContext(call);
}
+std::shared_ptr<const AuthContext> ServerContext::auth_context() const {
+ if (auth_context_.get() == nullptr) {
+ auth_context_ = CreateAuthContext(call_);
+ }
+ return auth_context_;
+}
+
} // namespace grpc