1 # Copyright 2015 gRPC authors.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 cdef class CallCredentials:
18 cdef grpc_call_credentials *c(self) except *
20 # TODO(https://github.com/grpc/grpc/issues/12531): remove.
21 cdef grpc_call_credentials *c_credentials
24 cdef int _get_metadata(
25 void *state, grpc_auth_metadata_context context,
26 grpc_credentials_plugin_metadata_cb cb, void *user_data,
27 grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
28 size_t *num_creds_md, grpc_status_code *status,
29 const char **error_details) except * with gil
31 cdef void _destroy(void *state) except * with gil
34 cdef class MetadataPluginCallCredentials(CallCredentials):
36 cdef readonly object _metadata_plugin
37 cdef readonly bytes _name
39 cdef grpc_call_credentials *c(self) except *
42 cdef grpc_call_credentials *_composition(call_credentialses)
45 cdef class CompositeCallCredentials(CallCredentials):
47 cdef readonly tuple _call_credentialses
49 cdef grpc_call_credentials *c(self) except *
52 cdef class ChannelCredentials:
54 cdef grpc_channel_credentials *c(self) except *
57 cdef class SSLSessionCacheLRU:
59 cdef grpc_ssl_session_cache *_cache
62 cdef class SSLChannelCredentials(ChannelCredentials):
64 cdef readonly object _pem_root_certificates
65 cdef readonly object _private_key
66 cdef readonly object _certificate_chain
68 cdef grpc_channel_credentials *c(self) except *
71 cdef class CompositeChannelCredentials(ChannelCredentials):
73 cdef readonly tuple _call_credentialses
74 cdef readonly ChannelCredentials _channel_credentials
76 cdef grpc_channel_credentials *c(self) except *
79 cdef class ServerCertificateConfig:
81 cdef grpc_ssl_server_certificate_config *c_cert_config
82 cdef const char *c_pem_root_certs
83 cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
84 cdef size_t c_ssl_pem_key_cert_pairs_count
88 cdef class ServerCredentials:
90 cdef grpc_server_credentials *c_credentials
91 cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
92 cdef size_t c_ssl_pem_key_cert_pairs_count
94 # the cert config related state is used only if this credentials is
95 # created with cert config/fetcher
96 cdef object initial_cert_config
97 cdef object cert_config_fetcher
98 # whether C-core has asked for the initial_cert_config
99 cdef bint initial_cert_config_fetched