From c29ffe649414c96ebc8fb75077941d737fda7d07 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Mon, 13 Jul 2020 14:34:50 -0700 Subject: [PATCH] Move AuthMetaDataProcessor from ::grpc_impl to ::grpc Reverts: https://github.com/grpc/grpc/pull/18436/files --- BUILD | 1 - BUILD.gn | 1 - CMakeLists.txt | 2 - Makefile | 2 - build_autogenerated.yaml | 2 - gRPC-C++.podspec | 1 - .../grpcpp/security/auth_metadata_processor.h | 37 ++++++++++- .../security/auth_metadata_processor_impl.h | 61 ------------------- tools/doxygen/Doxyfile.c++ | 1 - tools/doxygen/Doxyfile.c++.internal | 1 - 10 files changed, 34 insertions(+), 75 deletions(-) delete mode 100644 include/grpcpp/security/auth_metadata_processor_impl.h diff --git a/BUILD b/BUILD index 48fa1dfdb4a..c7160679c45 100644 --- a/BUILD +++ b/BUILD @@ -251,7 +251,6 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/resource_quota.h", "include/grpcpp/security/auth_context.h", "include/grpcpp/security/auth_metadata_processor.h", - "include/grpcpp/security/auth_metadata_processor_impl.h", "include/grpcpp/security/credentials.h", "include/grpcpp/security/credentials_impl.h", "include/grpcpp/security/server_credentials.h", diff --git a/BUILD.gn b/BUILD.gn index ea1e691aed5..c19eddd8e04 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1310,7 +1310,6 @@ config("grpc_config") { "include/grpcpp/resource_quota.h", "include/grpcpp/security/auth_context.h", "include/grpcpp/security/auth_metadata_processor.h", - "include/grpcpp/security/auth_metadata_processor_impl.h", "include/grpcpp/security/credentials.h", "include/grpcpp/security/credentials_impl.h", "include/grpcpp/security/server_credentials.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 61842a31b40..cc7eba4c96c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2891,7 +2891,6 @@ foreach(_hdr include/grpcpp/resource_quota.h include/grpcpp/security/auth_context.h include/grpcpp/security/auth_metadata_processor.h - include/grpcpp/security/auth_metadata_processor_impl.h include/grpcpp/security/credentials.h include/grpcpp/security/credentials_impl.h include/grpcpp/security/server_credentials.h @@ -3588,7 +3587,6 @@ foreach(_hdr include/grpcpp/resource_quota.h include/grpcpp/security/auth_context.h include/grpcpp/security/auth_metadata_processor.h - include/grpcpp/security/auth_metadata_processor_impl.h include/grpcpp/security/credentials.h include/grpcpp/security/credentials_impl.h include/grpcpp/security/server_credentials.h diff --git a/Makefile b/Makefile index 0cc937ebd15..1b091b59be9 100644 --- a/Makefile +++ b/Makefile @@ -5093,7 +5093,6 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \ - include/grpcpp/security/auth_metadata_processor_impl.h \ include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials_impl.h \ include/grpcpp/security/server_credentials.h \ @@ -5788,7 +5787,6 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \ - include/grpcpp/security/auth_metadata_processor_impl.h \ include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials_impl.h \ include/grpcpp/security/server_credentials.h \ diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 38dccf419a0..a198a3f8996 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -2418,7 +2418,6 @@ libs: - include/grpcpp/resource_quota.h - include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_metadata_processor.h - - include/grpcpp/security/auth_metadata_processor_impl.h - include/grpcpp/security/credentials.h - include/grpcpp/security/credentials_impl.h - include/grpcpp/security/server_credentials.h @@ -2807,7 +2806,6 @@ libs: - include/grpcpp/resource_quota.h - include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_metadata_processor.h - - include/grpcpp/security/auth_metadata_processor_impl.h - include/grpcpp/security/credentials.h - include/grpcpp/security/credentials_impl.h - include/grpcpp/security/server_credentials.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 7d0d152eff6..9d1b74c8a01 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -164,7 +164,6 @@ Pod::Spec.new do |s| 'include/grpcpp/resource_quota.h', 'include/grpcpp/security/auth_context.h', 'include/grpcpp/security/auth_metadata_processor.h', - 'include/grpcpp/security/auth_metadata_processor_impl.h', 'include/grpcpp/security/credentials.h', 'include/grpcpp/security/credentials_impl.h', 'include/grpcpp/security/server_credentials.h', diff --git a/include/grpcpp/security/auth_metadata_processor.h b/include/grpcpp/security/auth_metadata_processor.h index 1b66b72b967..02654611311 100644 --- a/include/grpcpp/security/auth_metadata_processor.h +++ b/include/grpcpp/security/auth_metadata_processor.h @@ -1,6 +1,6 @@ /* * - * Copyright 2019 gRPC authors. + * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,42 @@ #ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H #define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H -#include +#include + +#include +#include +#include namespace grpc { -typedef ::grpc_impl::AuthMetadataProcessor AuthMetadataProcessor; +/// Interface allowing custom server-side authorization based on credentials +/// encoded in metadata. Objects of this type can be passed to +/// \a ServerCredentials::SetAuthMetadataProcessor(). +class AuthMetadataProcessor { + public: + typedef std::multimap InputMetadata; + typedef std::multimap OutputMetadata; + + virtual ~AuthMetadataProcessor() {} + + /// If this method returns true, the \a Process function will be scheduled in + /// a different thread from the one processing the call. + virtual bool IsBlocking() const { return true; } + + /// context is read/write: it contains the properties of the channel peer and + /// it is the job of the Process method to augment it with properties derived + /// from the passed-in auth_metadata. + /// consumed_auth_metadata needs to be filled with metadata that has been + /// consumed by the processor and will be removed from the call. + /// response_metadata is the metadata that will be sent as part of the + /// response. + /// If the return value is not Status::OK, the rpc call will be aborted with + /// the error code and error message sent back to the client. + virtual grpc::Status Process(const InputMetadata& auth_metadata, + grpc::AuthContext* context, + OutputMetadata* consumed_auth_metadata, + OutputMetadata* response_metadata) = 0; +}; } // namespace grpc diff --git a/include/grpcpp/security/auth_metadata_processor_impl.h b/include/grpcpp/security/auth_metadata_processor_impl.h deleted file mode 100644 index ba80e488dc6..00000000000 --- a/include/grpcpp/security/auth_metadata_processor_impl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H -#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H - -#include - -#include -#include -#include - -namespace grpc_impl { - -/// Interface allowing custom server-side authorization based on credentials -/// encoded in metadata. Objects of this type can be passed to -/// \a ServerCredentials::SetAuthMetadataProcessor(). -class AuthMetadataProcessor { - public: - typedef std::multimap InputMetadata; - typedef std::multimap OutputMetadata; - - virtual ~AuthMetadataProcessor() {} - - /// If this method returns true, the \a Process function will be scheduled in - /// a different thread from the one processing the call. - virtual bool IsBlocking() const { return true; } - - /// context is read/write: it contains the properties of the channel peer and - /// it is the job of the Process method to augment it with properties derived - /// from the passed-in auth_metadata. - /// consumed_auth_metadata needs to be filled with metadata that has been - /// consumed by the processor and will be removed from the call. - /// response_metadata is the metadata that will be sent as part of the - /// response. - /// If the return value is not Status::OK, the rpc call will be aborted with - /// the error code and error message sent back to the client. - virtual grpc::Status Process(const InputMetadata& auth_metadata, - grpc::AuthContext* context, - OutputMetadata* consumed_auth_metadata, - OutputMetadata* response_metadata) = 0; -}; - -} // namespace grpc_impl - -#endif // GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index fd62c5079da..f1cef6dd8a9 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -1024,7 +1024,6 @@ include/grpcpp/impl/service_type.h \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \ -include/grpcpp/security/auth_metadata_processor_impl.h \ include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials_impl.h \ include/grpcpp/security/server_credentials.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 53ecaacce81..6f4645df791 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1024,7 +1024,6 @@ include/grpcpp/impl/service_type.h \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \ -include/grpcpp/security/auth_metadata_processor_impl.h \ include/grpcpp/security/credentials.h \ include/grpcpp/security/credentials_impl.h \ include/grpcpp/security/server_credentials.h \