GRPC C++  1.13.0-dev
server_credentials.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_SECURITY_SERVER_CREDENTIALS_H
20 #define GRPCPP_SECURITY_SERVER_CREDENTIALS_H
21 
22 #include <memory>
23 #include <vector>
24 
27 #include <grpcpp/support/config.h>
28 
29 struct grpc_server;
30 
31 namespace grpc {
32 class Server;
33 
36  public:
37  virtual ~ServerCredentials();
38 
41  virtual void SetAuthMetadataProcessor(
42  const std::shared_ptr<AuthMetadataProcessor>& processor) = 0;
43 
44  private:
45  friend class ::grpc::Server;
46 
51  // TODO(dgq): the "port" part seems to be a misnomer.
52  virtual int AddPortToServer(const grpc::string& addr,
53  grpc_server* server) = 0;
54 };
55 
60  : force_client_auth(false),
61  client_certificate_request(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) {}
64  : force_client_auth(false), client_certificate_request(request_type) {}
65 
66  struct PemKeyCertPair {
69  };
71  std::vector<PemKeyCertPair> pem_key_cert_pairs;
74 
80 };
81 
83 std::shared_ptr<ServerCredentials> SslServerCredentials(
84  const SslServerCredentialsOptions& options);
85 
87 std::shared_ptr<ServerCredentials> InsecureServerCredentials();
88 
89 namespace experimental {
90 
94 };
95 
97 std::shared_ptr<ServerCredentials> AltsServerCredentials(
98  const AltsServerCredentialsOptions& options);
99 
100 } // namespace experimental
101 } // namespace grpc
102 
103 #endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H
grpc::string cert_chain
Definition: server_credentials.h:68
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
Builds insecure server credentials.
std::string string
Definition: config.h:35
Definition: server_credentials.h:66
struct grpc_server grpc_server
A server listens to some port and responds to request calls.
Definition: grpc_types.h:65
bool force_client_auth
Definition: server_credentials.h:73
Wrapper around grpc_server_credentials, a way to authenticate a server.
Definition: server_credentials.h:35
std::vector< PemKeyCertPair > pem_key_cert_pairs
Definition: server_credentials.h:71
SslServerCredentialsOptions(grpc_ssl_client_certificate_request_type request_type)
Definition: server_credentials.h:62
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
grpc::string pem_root_certs
Definition: server_credentials.h:70
grpc_ssl_client_certificate_request_type
Definition: grpc_security_constants.h:59
virtual void SetAuthMetadataProcessor(const std::shared_ptr< AuthMetadataProcessor > &processor)=0
This method is not thread-safe and has to be called before the server is started. ...
Options to create ServerCredentials with SSL.
Definition: server_credentials.h:57
grpc_ssl_client_certificate_request_type client_certificate_request
If both force_client_auth and client_certificate_request fields are set, force_client_auth takes effe...
Definition: server_credentials.h:79
std::shared_ptr< ServerCredentials > AltsServerCredentials(const AltsServerCredentialsOptions &options)
Builds ALTS ServerCredentials given ALTS specific options.
std::shared_ptr< ServerCredentials > SslServerCredentials(const SslServerCredentialsOptions &options)
Builds SSL ServerCredentials given SSL specific options.
Options to create ServerCredentials with ALTS.
Definition: server_credentials.h:92
grpc::string private_key
Definition: server_credentials.h:67
SslServerCredentialsOptions()
Definition: server_credentials.h:59
Server does not request client certificate.
Definition: grpc_security_constants.h:63