|
|
|
@ -19,12 +19,12 @@ |
|
|
|
|
#ifndef GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H |
|
|
|
|
#define GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H |
|
|
|
|
|
|
|
|
|
#include <vector> |
|
|
|
|
#include <memory> |
|
|
|
|
#include <vector> |
|
|
|
|
|
|
|
|
|
#include <grpcpp/support/config.h> |
|
|
|
|
#include <grpc/support/log.h> |
|
|
|
|
#include <grpc/grpc_security.h> |
|
|
|
|
#include <grpc/support/log.h> |
|
|
|
|
#include <grpcpp/support/config.h> |
|
|
|
|
|
|
|
|
|
namespace grpc_impl { |
|
|
|
|
namespace experimental { |
|
|
|
@ -38,9 +38,7 @@ class TlsKeyMaterialsConfig { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** Getters for member fields. **/ |
|
|
|
|
const ::grpc::string pem_root_certs() const { |
|
|
|
|
return pem_root_certs_; |
|
|
|
|
} |
|
|
|
|
const ::grpc::string pem_root_certs() const { return pem_root_certs_; } |
|
|
|
|
const ::std::vector<PemKeyCertPair>& pem_key_cert_pair_list() const { |
|
|
|
|
return pem_key_cert_pair_list_; |
|
|
|
|
} |
|
|
|
@ -60,31 +58,25 @@ class TlsKeyMaterialsConfig { |
|
|
|
|
/** TLS credential reload arguments, wraps grpc_tls_credential_reload_arg. **/ |
|
|
|
|
typedef class TlsCredentialReloadArg TlsCredentialReloadArg; |
|
|
|
|
|
|
|
|
|
typedef void (*grpcpp_tls_on_credential_reload_done_cb)(TlsCredentialReloadArg* arg); |
|
|
|
|
typedef void (*grpcpp_tls_on_credential_reload_done_cb)( |
|
|
|
|
TlsCredentialReloadArg* arg); |
|
|
|
|
|
|
|
|
|
class TlsCredentialReloadArg { |
|
|
|
|
public: |
|
|
|
|
/** Getters for member fields. **/ |
|
|
|
|
grpcpp_tls_on_credential_reload_done_cb cb() const { |
|
|
|
|
return cb_; |
|
|
|
|
} |
|
|
|
|
void* cb_user_data() const { |
|
|
|
|
return cb_user_data_; |
|
|
|
|
} |
|
|
|
|
grpcpp_tls_on_credential_reload_done_cb cb() const { return cb_; } |
|
|
|
|
void* cb_user_data() const { return cb_user_data_; } |
|
|
|
|
::std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config() const { |
|
|
|
|
return key_materials_config_; |
|
|
|
|
} |
|
|
|
|
grpc_ssl_certificate_config_reload_status status() const { |
|
|
|
|
return status_; |
|
|
|
|
} |
|
|
|
|
::grpc::string error_details() const { |
|
|
|
|
return error_details_; |
|
|
|
|
} |
|
|
|
|
grpc_ssl_certificate_config_reload_status status() const { return status_; } |
|
|
|
|
::grpc::string error_details() const { return error_details_; } |
|
|
|
|
|
|
|
|
|
/** Setters for member fields. **/ |
|
|
|
|
void set_cb(grpcpp_tls_on_credential_reload_done_cb cb); |
|
|
|
|
void set_cb_user_data(void* cb_user_data); |
|
|
|
|
void set_key_materials_config(::std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config); |
|
|
|
|
void set_key_materials_config( |
|
|
|
|
::std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config); |
|
|
|
|
void set_status(grpc_ssl_certificate_config_reload_status status); |
|
|
|
|
void set_error_details(::grpc::string error_details); |
|
|
|
|
|
|
|
|
@ -102,11 +94,12 @@ class TlsCredentialReloadArg { |
|
|
|
|
/** TLS credential reloag config, wraps grpc_tls_credential_reload_config. **/ |
|
|
|
|
class TlsCredentialReloadConfig { |
|
|
|
|
public: |
|
|
|
|
TlsCredentialReloadConfig( |
|
|
|
|
const void* config_user_data, |
|
|
|
|
int (*schedule)(void* config_user_data, TlsCredentialReloadArg* arg), |
|
|
|
|
void (*cancel)(void* config_user_data, TlsCredentialReloadArg* arg), |
|
|
|
|
void (*destruct)(void* config_user_data)); |
|
|
|
|
TlsCredentialReloadConfig(const void* config_user_data, |
|
|
|
|
int (*schedule)(void* config_user_data, |
|
|
|
|
TlsCredentialReloadArg* arg), |
|
|
|
|
void (*cancel)(void* config_user_data, |
|
|
|
|
TlsCredentialReloadArg* arg), |
|
|
|
|
void (*destruct)(void* config_user_data)); |
|
|
|
|
~TlsCredentialReloadConfig(); |
|
|
|
|
|
|
|
|
|
int Schedule(TlsCredentialReloadArg* arg) const { |
|
|
|
@ -121,7 +114,7 @@ class TlsCredentialReloadConfig { |
|
|
|
|
cancel_(config_user_data_, arg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_tls_credential_reload_config* c_credential_reload() const; |
|
|
|
|
grpc_tls_credential_reload_config* c_credential_reload() const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
void* config_user_data_; |
|
|
|
@ -140,35 +133,26 @@ typedef void (*grpcpp_tls_on_server_authorization_check_done_cb)( |
|
|
|
|
class TlsServerAuthorizationCheckArg { |
|
|
|
|
public: |
|
|
|
|
/** Getters for member fields. **/ |
|
|
|
|
grpcpp_tls_on_server_authorization_check_done_cb cb() const { |
|
|
|
|
return cb_; |
|
|
|
|
} |
|
|
|
|
void* cb_user_data() const { |
|
|
|
|
return cb_user_data_; |
|
|
|
|
} |
|
|
|
|
int success() const { |
|
|
|
|
return success_; |
|
|
|
|
} |
|
|
|
|
::grpc::string peer_cert() const { |
|
|
|
|
return peer_cert_; |
|
|
|
|
} |
|
|
|
|
grpc_status_code status() const { |
|
|
|
|
return status_; |
|
|
|
|
} |
|
|
|
|
::grpc::string error_details() const { |
|
|
|
|
return error_details_; |
|
|
|
|
} |
|
|
|
|
grpcpp_tls_on_server_authorization_check_done_cb cb() const { return cb_; } |
|
|
|
|
void* cb_user_data() const { return cb_user_data_; } |
|
|
|
|
int success() const { return success_; } |
|
|
|
|
::grpc::string peer_cert() const { return peer_cert_; } |
|
|
|
|
grpc_status_code status() const { return status_; } |
|
|
|
|
::grpc::string error_details() const { return error_details_; } |
|
|
|
|
|
|
|
|
|
/** Setters for member fields. **/ |
|
|
|
|
void set_cb(grpcpp_tls_on_server_authorization_check_done_cb cb); |
|
|
|
|
void set_cb_user_data(void* cb_user_data); |
|
|
|
|
void set_success(int success); |
|
|
|
|
void set_peer_cert(::grpc::string peer_cert); |
|
|
|
|
void set_status(grpc_status_code status); |
|
|
|
|
void set_error_details(::grpc::string error_details); |
|
|
|
|
void set_cb(grpcpp_tls_on_server_authorization_check_done_cb cb) { cb_ = cb; } |
|
|
|
|
void set_cb_user_data(void* cb_user_data) { cb_user_data_ = cb_user_data; } |
|
|
|
|
void set_success(int success) { success_ = success; } |
|
|
|
|
void set_peer_cert(::grpc::string peer_cert) { peer_cert_ = peer_cert; } |
|
|
|
|
void set_status(grpc_status_code status) { status_ = status; } |
|
|
|
|
void set_error_details(::grpc::string error_details) { |
|
|
|
|
error_details_ = error_details; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Creates C struct for credential reload arg. **/ |
|
|
|
|
grpc_tls_credential_reload_arg* c_credential_reload_arg() const; |
|
|
|
|
/** Creates C struct for server authorization check arg. **/ |
|
|
|
|
grpc_tls_server_authorization_check_arg* c_server_authorization_check_arg() |
|
|
|
|
const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
grpcpp_tls_on_server_authorization_check_done_cb cb_; |
|
|
|
@ -180,15 +164,16 @@ class TlsServerAuthorizationCheckArg { |
|
|
|
|
::grpc::string error_details_; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** TLS server authorization check config, wraps
|
|
|
|
|
* grps_tls_server_authorization_check_config. **/ |
|
|
|
|
class TlsServerAuthorizationCheckConfig { |
|
|
|
|
public: |
|
|
|
|
TlsServerAuthorizationCheckConfig( |
|
|
|
|
const void* config_user_data, |
|
|
|
|
int (*schedule)(void* config_user_data, TlsServerAuthorizationCheckArg* arg), |
|
|
|
|
void (*cancel)(void* config_user_data, TlsServerAuthorizationCheckArg* arg), |
|
|
|
|
int (*schedule)(void* config_user_data, |
|
|
|
|
TlsServerAuthorizationCheckArg* arg), |
|
|
|
|
void (*cancel)(void* config_user_data, |
|
|
|
|
TlsServerAuthorizationCheckArg* arg), |
|
|
|
|
void (*destruct)(void* config_user_data)); |
|
|
|
|
~TlsServerAuthorizationCheckConfig(); |
|
|
|
|
|
|
|
|
@ -204,30 +189,32 @@ class TlsServerAuthorizationCheckConfig { |
|
|
|
|
cancel_(config_user_data_, arg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_tls_server_authorization_check_config* c_server_authorization_check() const; |
|
|
|
|
grpc_tls_server_authorization_check_config* c_server_authorization_check() |
|
|
|
|
const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
void* config_user_data_; |
|
|
|
|
int (*schedule_)(void* config_user_data, TlsServerAuthorizationCheckArg* arg); |
|
|
|
|
void (*cancel_)(void* config_user_data, TlsServerAuthorizationCheckArg* arg); |
|
|
|
|
void (*destruct_)(void* config_user_data); |
|
|
|
|
void* config_user_data_; |
|
|
|
|
int (*schedule_)(void* config_user_data, TlsServerAuthorizationCheckArg* arg); |
|
|
|
|
void (*cancel_)(void* config_user_data, TlsServerAuthorizationCheckArg* arg); |
|
|
|
|
void (*destruct_)(void* config_user_data); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** TLS credentials options, wrapper for grpc_tls_credentials_options. **/ |
|
|
|
|
class TlsCredentialsOptions { |
|
|
|
|
public: |
|
|
|
|
/** Getters for member fields. **/ |
|
|
|
|
grpc_ssl_client_certificate_request_type cert_request_type() const{ |
|
|
|
|
grpc_ssl_client_certificate_request_type cert_request_type() const { |
|
|
|
|
return cert_request_type_; |
|
|
|
|
} |
|
|
|
|
std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config() const { |
|
|
|
|
return key_materials_config_; |
|
|
|
|
} |
|
|
|
|
::std::shared_ptr<TlsCredentialReloadConfig> credential_reload_config() const { |
|
|
|
|
::std::shared_ptr<TlsCredentialReloadConfig> credential_reload_config() |
|
|
|
|
const { |
|
|
|
|
return credential_reload_config_; |
|
|
|
|
} |
|
|
|
|
::std::shared_ptr<TlsServerAuthorizationCheckConfig> server_authorization_check_config() const { |
|
|
|
|
::std::shared_ptr<TlsServerAuthorizationCheckConfig> |
|
|
|
|
server_authorization_check_config() const { |
|
|
|
|
return server_authorization_check_config_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -236,8 +223,7 @@ class TlsCredentialsOptions { |
|
|
|
|
const grpc_ssl_client_certificate_request_type type) { |
|
|
|
|
cert_request_type_ = type; |
|
|
|
|
} |
|
|
|
|
void set_key_materials_config( |
|
|
|
|
std::shared_ptr<TlsKeyMaterialsConfig> config) { |
|
|
|
|
void set_key_materials_config(std::shared_ptr<TlsKeyMaterialsConfig> config) { |
|
|
|
|
key_materials_config_ = config; |
|
|
|
|
} |
|
|
|
|
void set_credential_reload_config( |
|
|
|
@ -256,12 +242,11 @@ class TlsCredentialsOptions { |
|
|
|
|
grpc_ssl_client_certificate_request_type cert_request_type_; |
|
|
|
|
::std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config_; |
|
|
|
|
::std::shared_ptr<TlsCredentialReloadConfig> credential_reload_config_; |
|
|
|
|
::std::shared_ptr<TlsServerAuthorizationCheckConfig> server_authorization_check_config_; |
|
|
|
|
|
|
|
|
|
::std::shared_ptr<TlsServerAuthorizationCheckConfig> |
|
|
|
|
server_authorization_check_config_; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
} // namespace experimental
|
|
|
|
|
} // namespace grpc_impl
|
|
|
|
|
|
|
|
|
|
#endif // GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
|
|
|
|
|
} // namespace experimental
|
|
|
|
|
} // namespace grpc_impl
|
|
|
|
|
|
|
|
|
|
#endif // GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
|
|
|
|
|