diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 10757e9..c4c613c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,7 @@ +2.0.3 +===== +* Added support for authentication via client-side certificates + 2.0.2 ===== * Fixed contains functions diff --git a/pyArango/connection.py b/pyArango/connection.py index c56b700..c7fa332 100644 --- a/pyArango/connection.py +++ b/pyArango/connection.py @@ -83,6 +83,7 @@ def __init__( username, password, verify=True, + cert=None, max_conflict_retries=5, max_retries=5, single_session=True, @@ -96,6 +97,7 @@ def __init__( self.auth = None self.pool_maxsize = pool_maxsize self.verify = verify + self.cert = cert self.max_retries = max_retries self.log_requests = log_requests self.max_conflict_retries = max_conflict_retries @@ -122,6 +124,8 @@ def _make_session(self): https = requests.adapters.HTTPAdapter(**kwargs) session.mount('http://', http) session.mount('https://', https) + if self.cert: + session.cert = self.cert return session @@ -198,6 +202,7 @@ def __init__( username=None, password=None, verify=True, + cert=None, verbose=False, statsdClient=None, reportFileName=None, @@ -241,7 +246,7 @@ def __init__( self.identifier = None self.startTime = None self.session = None - self.resetSession(username, password, verify) + self.resetSession(username, password, verify, cert) self.users = Users(self) @@ -295,12 +300,14 @@ def create_aikido_session( self, username, password, - verify + verify, + cert ) -> AikidoSession: return AikidoSession( username=username, password=password, verify=verify, + cert=cert, single_session=True, max_conflict_retries=self.max_conflict_retries, max_retries=self.max_retries, @@ -324,10 +331,12 @@ def create_grequest_session( verify ) - def resetSession(self, username=None, password=None, verify=True): + def resetSession(self, username=None, password=None, verify=True, cert=None): """resets the session""" self.disconnectSession() if self.use_grequests: + if cert is not None: + raise NotImplementedError('client-side certificates not supported in conjunction with grequests yet') self.session = self.create_grequest_session( username, password, @@ -337,7 +346,8 @@ def resetSession(self, username=None, password=None, verify=True): self.session = self.create_aikido_session( username, password, - verify + verify, + cert ) def reload(self):