Move ServerCredentials from ::grpc_impl to ::grpc
Reverts: https://github.com/grpc/grpc/pull/18452
This commit is contained in:
parent
79c1294720
commit
2fc4cfadcf
1
BUILD
1
BUILD
|
|
@ -253,7 +253,6 @@ GRPCXX_PUBLIC_HDRS = [
|
|||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/credentials_impl.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/security/server_credentials_impl.h",
|
||||
"include/grpcpp/security/tls_credentials_options.h",
|
||||
"include/grpcpp/server.h",
|
||||
"include/grpcpp/server_impl.h",
|
||||
|
|
|
|||
1
BUILD.gn
1
BUILD.gn
|
|
@ -1179,7 +1179,6 @@ config("grpc_config") {
|
|||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/credentials_impl.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/security/server_credentials_impl.h",
|
||||
"include/grpcpp/security/tls_credentials_options.h",
|
||||
"include/grpcpp/server.h",
|
||||
"include/grpcpp/server_builder.h",
|
||||
|
|
|
|||
|
|
@ -2821,7 +2821,6 @@ foreach(_hdr
|
|||
include/grpcpp/security/credentials.h
|
||||
include/grpcpp/security/credentials_impl.h
|
||||
include/grpcpp/security/server_credentials.h
|
||||
include/grpcpp/security/server_credentials_impl.h
|
||||
include/grpcpp/security/tls_credentials_options.h
|
||||
include/grpcpp/server.h
|
||||
include/grpcpp/server_builder.h
|
||||
|
|
@ -3515,7 +3514,6 @@ foreach(_hdr
|
|||
include/grpcpp/security/credentials.h
|
||||
include/grpcpp/security/credentials_impl.h
|
||||
include/grpcpp/security/server_credentials.h
|
||||
include/grpcpp/security/server_credentials_impl.h
|
||||
include/grpcpp/security/tls_credentials_options.h
|
||||
include/grpcpp/server.h
|
||||
include/grpcpp/server_builder.h
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -4971,7 +4971,6 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/credentials_impl.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/security/server_credentials_impl.h \
|
||||
include/grpcpp/security/tls_credentials_options.h \
|
||||
include/grpcpp/server.h \
|
||||
include/grpcpp/server_builder.h \
|
||||
|
|
@ -5663,7 +5662,6 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/credentials_impl.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/security/server_credentials_impl.h \
|
||||
include/grpcpp/security/tls_credentials_options.h \
|
||||
include/grpcpp/server.h \
|
||||
include/grpcpp/server_builder.h \
|
||||
|
|
|
|||
|
|
@ -2154,7 +2154,6 @@ libs:
|
|||
- include/grpcpp/security/credentials.h
|
||||
- include/grpcpp/security/credentials_impl.h
|
||||
- include/grpcpp/security/server_credentials.h
|
||||
- include/grpcpp/security/server_credentials_impl.h
|
||||
- include/grpcpp/security/tls_credentials_options.h
|
||||
- include/grpcpp/server.h
|
||||
- include/grpcpp/server_builder.h
|
||||
|
|
@ -2540,7 +2539,6 @@ libs:
|
|||
- include/grpcpp/security/credentials.h
|
||||
- include/grpcpp/security/credentials_impl.h
|
||||
- include/grpcpp/security/server_credentials.h
|
||||
- include/grpcpp/security/server_credentials_impl.h
|
||||
- include/grpcpp/security/tls_credentials_options.h
|
||||
- include/grpcpp/server.h
|
||||
- include/grpcpp/server_builder.h
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ Pod::Spec.new do |s|
|
|||
'include/grpcpp/security/credentials.h',
|
||||
'include/grpcpp/security/credentials_impl.h',
|
||||
'include/grpcpp/security/server_credentials.h',
|
||||
'include/grpcpp/security/server_credentials_impl.h',
|
||||
'include/grpcpp/security/tls_credentials_options.h',
|
||||
'include/grpcpp/server.h',
|
||||
'include/grpcpp/server_builder.h',
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ namespace grpc_impl {
|
|||
class Channel;
|
||||
class CompletionQueue;
|
||||
class ServerCompletionQueue;
|
||||
class ServerCredentials;
|
||||
} // namespace grpc_impl
|
||||
namespace grpc {
|
||||
|
||||
class AsyncGenericService;
|
||||
class GenericServerContext;
|
||||
class ServerCredentials;
|
||||
class Service;
|
||||
|
||||
extern CoreCodegenInterface* g_core_codegen_interface;
|
||||
|
|
@ -173,7 +173,7 @@ class ServerInterface : public internal::CallHook {
|
|||
///
|
||||
/// \warning It's an error to call this method on an already started server.
|
||||
virtual int AddListeningPort(const std::string& addr,
|
||||
grpc_impl::ServerCredentials* creds) = 0;
|
||||
ServerCredentials* creds) = 0;
|
||||
|
||||
/// Start the server.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -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,71 +19,69 @@
|
|||
#ifndef GRPCPP_SECURITY_SERVER_CREDENTIALS_H
|
||||
#define GRPCPP_SECURITY_SERVER_CREDENTIALS_H
|
||||
|
||||
#include <grpcpp/security/server_credentials_impl.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <grpc/grpc_security_constants.h>
|
||||
#include <grpcpp/security/auth_metadata_processor.h>
|
||||
#include <grpcpp/security/tls_credentials_options.h>
|
||||
#include <grpcpp/support/config.h>
|
||||
|
||||
struct grpc_server;
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
class Server;
|
||||
} // namespace grpc_impl
|
||||
namespace grpc {
|
||||
struct SslServerCredentialsOptions;
|
||||
|
||||
typedef ::grpc_impl::ServerCredentials ServerCredentials;
|
||||
/// Wrapper around \a grpc_server_credentials, a way to authenticate a server.
|
||||
class ServerCredentials {
|
||||
public:
|
||||
virtual ~ServerCredentials();
|
||||
|
||||
/// Options to create ServerCredentials with SSL
|
||||
struct SslServerCredentialsOptions {
|
||||
/// \warning Deprecated
|
||||
SslServerCredentialsOptions()
|
||||
: force_client_auth(false),
|
||||
client_certificate_request(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) {}
|
||||
SslServerCredentialsOptions(
|
||||
grpc_ssl_client_certificate_request_type request_type)
|
||||
: force_client_auth(false), client_certificate_request(request_type) {}
|
||||
/// This method is not thread-safe and has to be called before the server is
|
||||
/// started. The last call to this function wins.
|
||||
virtual void SetAuthMetadataProcessor(
|
||||
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) = 0;
|
||||
|
||||
struct PemKeyCertPair {
|
||||
std::string private_key;
|
||||
std::string cert_chain;
|
||||
};
|
||||
std::string pem_root_certs;
|
||||
std::vector<PemKeyCertPair> pem_key_cert_pairs;
|
||||
/// \warning Deprecated
|
||||
bool force_client_auth;
|
||||
private:
|
||||
friend class ::grpc_impl::Server;
|
||||
|
||||
/// If both \a force_client_auth and \a client_certificate_request
|
||||
/// fields are set, \a force_client_auth takes effect, i.e.
|
||||
/// \a REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
|
||||
/// will be enforced.
|
||||
grpc_ssl_client_certificate_request_type client_certificate_request;
|
||||
/// Tries to bind \a server to the given \a addr (eg, localhost:1234,
|
||||
/// 192.168.1.1:31416, [::1]:27182, etc.)
|
||||
///
|
||||
/// \return bound port number on success, 0 on failure.
|
||||
// TODO(dgq): the "port" part seems to be a misnomer.
|
||||
virtual int AddPortToServer(const std::string& addr, grpc_server* server) = 0;
|
||||
};
|
||||
|
||||
static inline std::shared_ptr<ServerCredentials> SslServerCredentials(
|
||||
const SslServerCredentialsOptions& options) {
|
||||
return ::grpc_impl::SslServerCredentials(options);
|
||||
}
|
||||
/// Builds SSL ServerCredentials given SSL specific options
|
||||
std::shared_ptr<ServerCredentials> SslServerCredentials(
|
||||
const grpc::SslServerCredentialsOptions& options);
|
||||
|
||||
static inline std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
|
||||
return ::grpc_impl::InsecureServerCredentials();
|
||||
}
|
||||
/// Builds insecure server credentials.
|
||||
std::shared_ptr<ServerCredentials> InsecureServerCredentials();
|
||||
|
||||
namespace experimental {
|
||||
|
||||
typedef ::grpc_impl::experimental::AltsServerCredentialsOptions
|
||||
AltsServerCredentialsOptions;
|
||||
/// Options to create ServerCredentials with ALTS
|
||||
struct AltsServerCredentialsOptions {
|
||||
/// Add fields if needed.
|
||||
};
|
||||
|
||||
static inline std::shared_ptr<ServerCredentials> AltsServerCredentials(
|
||||
const AltsServerCredentialsOptions& options) {
|
||||
return ::grpc_impl::experimental::AltsServerCredentials(options);
|
||||
}
|
||||
/// Builds ALTS ServerCredentials given ALTS specific options
|
||||
std::shared_ptr<ServerCredentials> AltsServerCredentials(
|
||||
const AltsServerCredentialsOptions& options);
|
||||
|
||||
static inline std::shared_ptr<ServerCredentials> LocalServerCredentials(
|
||||
grpc_local_connect_type type) {
|
||||
return ::grpc_impl::experimental::LocalServerCredentials(type);
|
||||
}
|
||||
/// Builds Local ServerCredentials.
|
||||
std::shared_ptr<ServerCredentials> LocalServerCredentials(
|
||||
grpc_local_connect_type type);
|
||||
|
||||
/// Builds TLS ServerCredentials given TLS options.
|
||||
static inline std::shared_ptr<ServerCredentials> TlsServerCredentials(
|
||||
const ::grpc_impl::experimental::TlsCredentialsOptions& options) {
|
||||
return ::grpc_impl::experimental::TlsServerCredentials(options);
|
||||
}
|
||||
std::shared_ptr<ServerCredentials> TlsServerCredentials(
|
||||
const TlsCredentialsOptions& options);
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -1,89 +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_SERVER_CREDENTIALS_IMPL_H
|
||||
#define GRPCPP_SECURITY_SERVER_CREDENTIALS_IMPL_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <grpc/grpc_security_constants.h>
|
||||
#include <grpcpp/security/auth_metadata_processor.h>
|
||||
#include <grpcpp/security/tls_credentials_options.h>
|
||||
#include <grpcpp/support/config.h>
|
||||
|
||||
struct grpc_server;
|
||||
|
||||
namespace grpc {
|
||||
|
||||
struct SslServerCredentialsOptions;
|
||||
} // namespace grpc
|
||||
namespace grpc_impl {
|
||||
class Server;
|
||||
|
||||
/// Wrapper around \a grpc_server_credentials, a way to authenticate a server.
|
||||
class ServerCredentials {
|
||||
public:
|
||||
virtual ~ServerCredentials();
|
||||
|
||||
/// This method is not thread-safe and has to be called before the server is
|
||||
/// started. The last call to this function wins.
|
||||
virtual void SetAuthMetadataProcessor(
|
||||
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) = 0;
|
||||
|
||||
private:
|
||||
friend class ::grpc_impl::Server;
|
||||
|
||||
/// Tries to bind \a server to the given \a addr (eg, localhost:1234,
|
||||
/// 192.168.1.1:31416, [::1]:27182, etc.)
|
||||
///
|
||||
/// \return bound port number on success, 0 on failure.
|
||||
// TODO(dgq): the "port" part seems to be a misnomer.
|
||||
virtual int AddPortToServer(const std::string& addr, grpc_server* server) = 0;
|
||||
};
|
||||
|
||||
/// Builds SSL ServerCredentials given SSL specific options
|
||||
std::shared_ptr<ServerCredentials> SslServerCredentials(
|
||||
const grpc::SslServerCredentialsOptions& options);
|
||||
|
||||
/// Builds insecure server credentials.
|
||||
std::shared_ptr<ServerCredentials> InsecureServerCredentials();
|
||||
|
||||
namespace experimental {
|
||||
|
||||
/// Options to create ServerCredentials with ALTS
|
||||
struct AltsServerCredentialsOptions {
|
||||
/// Add fields if needed.
|
||||
};
|
||||
|
||||
/// Builds ALTS ServerCredentials given ALTS specific options
|
||||
std::shared_ptr<ServerCredentials> AltsServerCredentials(
|
||||
const AltsServerCredentialsOptions& options);
|
||||
|
||||
/// Builds Local ServerCredentials.
|
||||
std::shared_ptr<ServerCredentials> LocalServerCredentials(
|
||||
grpc_local_connect_type type);
|
||||
|
||||
/// Builds TLS ServerCredentials given TLS options.
|
||||
std::shared_ptr<ServerCredentials> TlsServerCredentials(
|
||||
const TlsCredentialsOptions& options);
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_IMPL_H
|
||||
|
|
@ -43,12 +43,12 @@ namespace grpc_impl {
|
|||
class CompletionQueue;
|
||||
class Server;
|
||||
class ServerCompletionQueue;
|
||||
class ServerCredentials;
|
||||
} // namespace grpc_impl
|
||||
|
||||
namespace grpc {
|
||||
|
||||
class AsyncGenericService;
|
||||
class ServerCredentials;
|
||||
class Service;
|
||||
namespace testing {
|
||||
class ServerBuilderPluginTest;
|
||||
|
|
@ -130,7 +130,7 @@ class ServerBuilder {
|
|||
/// does not modify this pointer.
|
||||
ServerBuilder& AddListeningPort(
|
||||
const std::string& addr_uri,
|
||||
std::shared_ptr<grpc_impl::ServerCredentials> creds,
|
||||
std::shared_ptr<grpc::ServerCredentials> creds,
|
||||
int* selected_port = nullptr);
|
||||
|
||||
/// Add a completion queue for handling asynchronous services.
|
||||
|
|
@ -312,7 +312,7 @@ class ServerBuilder {
|
|||
/// Experimental, to be deprecated
|
||||
struct Port {
|
||||
std::string addr;
|
||||
std::shared_ptr<grpc_impl::ServerCredentials> creds;
|
||||
std::shared_ptr<ServerCredentials> creds;
|
||||
int* selected_port;
|
||||
};
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ class ServerBuilder {
|
|||
/// List of completion queues added via \a AddCompletionQueue method.
|
||||
std::vector<grpc_impl::ServerCompletionQueue*> cqs_;
|
||||
|
||||
std::shared_ptr<grpc_impl::ServerCredentials> creds_;
|
||||
std::shared_ptr<grpc::ServerCredentials> creds_;
|
||||
std::vector<std::unique_ptr<grpc::ServerBuilderPlugin>> plugins_;
|
||||
grpc_resource_quota* resource_quota_;
|
||||
grpc::AsyncGenericService* generic_service_{nullptr};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
#include <grpcpp/security/server_credentials.h>
|
||||
#include <grpcpp/security/server_credentials_impl.h>
|
||||
#include <grpcpp/server_builder.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <grpc/grpc.h>
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
namespace grpc_impl {
|
||||
namespace grpc {
|
||||
namespace {
|
||||
class InsecureServerCredentialsImpl final : public ServerCredentials {
|
||||
public:
|
||||
|
|
@ -41,4 +41,4 @@ std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
|
|||
new InsecureServerCredentialsImpl());
|
||||
}
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -92,10 +92,6 @@ void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
|
|||
status.error_message().c_str());
|
||||
}
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
int SecureServerCredentials::AddPortToServer(const std::string& addr,
|
||||
grpc_server* server) {
|
||||
return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_);
|
||||
|
|
@ -156,4 +152,4 @@ std::shared_ptr<ServerCredentials> TlsServerCredentials(
|
|||
}
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -28,14 +28,9 @@
|
|||
|
||||
#include "src/cpp/server/thread_pool_interface.h"
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
class SecureServerCredentials;
|
||||
} // namespace grpc_impl
|
||||
|
||||
namespace grpc {
|
||||
|
||||
typedef ::grpc_impl::SecureServerCredentials SecureServerCredentials;
|
||||
class SecureServerCredentials;
|
||||
|
||||
class AuthMetadataProcessorAyncWrapper final {
|
||||
public:
|
||||
|
|
@ -61,10 +56,6 @@ class AuthMetadataProcessorAyncWrapper final {
|
|||
std::shared_ptr<AuthMetadataProcessor> processor_;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
class SecureServerCredentials final : public ServerCredentials {
|
||||
public:
|
||||
explicit SecureServerCredentials(grpc_server_credentials* creds)
|
||||
|
|
@ -83,6 +74,6 @@ class SecureServerCredentials final : public ServerCredentials {
|
|||
std::unique_ptr<grpc::AuthMetadataProcessorAyncWrapper> processor_;
|
||||
};
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <grpcpp/security/server_credentials_impl.h>
|
||||
#include <grpcpp/security/server_credentials.h>
|
||||
|
||||
namespace grpc_impl {
|
||||
namespace grpc {
|
||||
|
||||
ServerCredentials::~ServerCredentials() {}
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -1026,7 +1026,6 @@ include/grpcpp/security/auth_metadata_processor.h \
|
|||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/credentials_impl.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/security/server_credentials_impl.h \
|
||||
include/grpcpp/security/tls_credentials_options.h \
|
||||
include/grpcpp/server.h \
|
||||
include/grpcpp/server_builder.h \
|
||||
|
|
|
|||
|
|
@ -1026,7 +1026,6 @@ include/grpcpp/security/auth_metadata_processor.h \
|
|||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/credentials_impl.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/security/server_credentials_impl.h \
|
||||
include/grpcpp/security/tls_credentials_options.h \
|
||||
include/grpcpp/server.h \
|
||||
include/grpcpp/server_builder.h \
|
||||
|
|
|
|||
Loading…
Reference in New Issue