Add force_client_auth to _low.ServerCredentials

pull/3103/head
Nathaniel Manista 10 years ago
parent b17ad5562f
commit 7dc25d3ca6
  1. 13
      src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c
  2. 3
      src/python/grpcio/grpc/_adapter/_intermediary_low.py

@ -99,11 +99,13 @@ ServerCredentials *pygrpc_ServerCredentials_ssl(
const char *root_certs;
PyObject *py_key_cert_pairs;
grpc_ssl_pem_key_cert_pair *key_cert_pairs;
int force_client_auth;
size_t num_key_cert_pairs;
size_t i;
static char *keywords[] = {"root_certs", "key_cert_pairs", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zO:ssl", keywords,
&root_certs, &py_key_cert_pairs)) {
static char *keywords[] = {
"root_certs", "key_cert_pairs", "force_client_auth", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zOi:ssl", keywords,
&root_certs, &py_key_cert_pairs, &force_client_auth)) {
return NULL;
}
if (!PyList_Check(py_key_cert_pairs)) {
@ -128,11 +130,8 @@ ServerCredentials *pygrpc_ServerCredentials_ssl(
}
self = (ServerCredentials *)type->tp_alloc(type, 0);
/* TODO: Add a force_client_auth parameter in the python object and pass it
here as the last arg. */
self->c_creds = grpc_ssl_server_credentials_create(
root_certs, key_cert_pairs, num_key_cert_pairs, 0, NULL);
root_certs, key_cert_pairs, num_key_cert_pairs, force_client_auth, NULL);
gpr_free(key_cert_pairs);
return self;
}

@ -256,4 +256,5 @@ class ServerCredentials(object):
"""Adapter from old _low.ServerCredentials interface to new _low.ServerCredentials."""
def __init__(self, root_credentials, pair_sequence):
self._internal = _low.ServerCredentials.ssl(root_credentials, list(pair_sequence))
self._internal = _low.ServerCredentials.ssl(
root_credentials, list(pair_sequence), False)

Loading…
Cancel
Save