aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-08-27 16:55:14 -0400
committerGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-08-27 16:55:14 -0400
commit60ff5c3c872b9630e256772c0440a169c7cfae10 (patch)
treee77d39b94db38b56289a9717b431219724280ac9 /src
parentf03e12826076d2dfaf0969d84c4ea7524876666a (diff)
parent7dc25d3ca6fd5233906567d7b0592894c762d44e (diff)
Merge pull request #3103 from nathanielmanistaatgoogle/force_client_auth
Add force_client_auth to grpc._adapter._low.ServerCredentials.
Diffstat (limited to 'src')
-rw-r--r--src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c13
-rw-r--r--src/python/grpcio/grpc/_adapter/_intermediary_low.py3
2 files changed, 8 insertions, 8 deletions
diff --git a/src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c b/src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c
index 2ba855e76c..df51a99b6a 100644
--- a/src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c
+++ b/src/python/grpcio/grpc/_adapter/_c/types/server_credentials.c
@@ -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;
}
-
diff --git a/src/python/grpcio/grpc/_adapter/_intermediary_low.py b/src/python/grpcio/grpc/_adapter/_intermediary_low.py
index e7bf9dc462..1fb6a2b27d 100644
--- a/src/python/grpcio/grpc/_adapter/_intermediary_low.py
+++ b/src/python/grpcio/grpc/_adapter/_intermediary_low.py
@@ -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)