Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/resource_quota_impl.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/server_credentials.h",
"include/grpcpp/server.h",
Expand Down
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ 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/server_credentials.h",
"include/grpcpp/server.h",
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3027,6 +3027,7 @@ foreach(_hdr
include/grpcpp/resource_quota_impl.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/server_credentials.h
include/grpcpp/server.h
Expand Down Expand Up @@ -3624,6 +3625,7 @@ foreach(_hdr
include/grpcpp/resource_quota_impl.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/server_credentials.h
include/grpcpp/server.h
Expand Down Expand Up @@ -4593,6 +4595,7 @@ foreach(_hdr
include/grpcpp/resource_quota_impl.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/server_credentials.h
include/grpcpp/server.h
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5358,6 +5358,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/resource_quota_impl.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/server_credentials.h \
include/grpcpp/server.h \
Expand Down Expand Up @@ -5963,6 +5964,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/resource_quota_impl.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/server_credentials.h \
include/grpcpp/server.h \
Expand Down Expand Up @@ -6881,6 +6883,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/resource_quota_impl.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/server_credentials.h \
include/grpcpp/server.h \
Expand Down
1 change: 1 addition & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ filegroups:
- include/grpcpp/resource_quota_impl.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/server_credentials.h
- include/grpcpp/server.h
Expand Down
1 change: 1 addition & 0 deletions gRPC-C++.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Pod::Spec.new do |s|
'include/grpcpp/resource_quota_impl.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/server_credentials.h',
'include/grpcpp/server.h',
Expand Down
37 changes: 3 additions & 34 deletions include/grpcpp/security/auth_metadata_processor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright 2015 gRPC authors.
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,42 +19,11 @@
#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H
#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H

#include <map>

#include <grpcpp/security/auth_context.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
#include <grpcpp/security/auth_metadata_processor_impl.h>

namespace grpc {

/// 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<grpc::string_ref, grpc::string_ref> InputMetadata;
typedef std::multimap<grpc::string, grpc::string> 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 Status Process(const InputMetadata& auth_metadata,
AuthContext* context,
OutputMetadata* consumed_auth_metadata,
OutputMetadata* response_metadata) = 0;
};
typedef ::grpc_impl::AuthMetadataProcessor AuthMetadataProcessor;

} // namespace grpc

Expand Down
61 changes: 61 additions & 0 deletions include/grpcpp/security/auth_metadata_processor_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
*
* 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 <map>

#include <grpcpp/security/auth_context.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>

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<grpc::string_ref, grpc::string_ref> InputMetadata;
typedef std::multimap<grpc::string, grpc::string> 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
1 change: 1 addition & 0 deletions tools/doxygen/Doxyfile.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ include/grpcpp/resource_quota.h \
include/grpcpp/resource_quota_impl.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/server_credentials.h \
include/grpcpp/server.h \
Expand Down
1 change: 1 addition & 0 deletions tools/doxygen/Doxyfile.c++.internal
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ include/grpcpp/resource_quota.h \
include/grpcpp/resource_quota_impl.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/server_credentials.h \
include/grpcpp/server.h \
Expand Down
2 changes: 2 additions & 0 deletions tools/run_tests/generated/sources_and_headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -10118,6 +10118,7 @@
"include/grpcpp/resource_quota_impl.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/server_credentials.h",
"include/grpcpp/server.h",
Expand Down Expand Up @@ -10233,6 +10234,7 @@
"include/grpcpp/resource_quota_impl.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/server_credentials.h",
"include/grpcpp/server.h",
Expand Down