diff --git a/neptune/client.py b/neptune/client.py index b7c3dbc0d..2441c33ab 100644 --- a/neptune/client.py +++ b/neptune/client.py @@ -115,7 +115,8 @@ def __init__(self, api_address, api_token, proxies=None): ) self.authenticator = NeptuneAuthenticator( - self.backend_swagger_client.api.exchangeApiToken(X_Neptune_Api_Token=api_token).response().result + self.backend_swagger_client.api.exchangeApiToken(X_Neptune_Api_Token=api_token).response().result, + ssl_verify ) self._http_client.authenticator = self.authenticator diff --git a/neptune/oauth.py b/neptune/oauth.py index cd5823880..c7431abc0 100644 --- a/neptune/oauth.py +++ b/neptune/oauth.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import time import jwt @@ -57,7 +56,7 @@ def _refresh_token(self): class NeptuneAuthenticator(Authenticator): - def __init__(self, auth_tokens): + def __init__(self, auth_tokens, ssl_verify): super(NeptuneAuthenticator, self).__init__(host='') decoded_json_token = jwt.decode(auth_tokens.accessToken, verify=False) expires_at = decoded_json_token.get(u'exp') @@ -68,13 +67,15 @@ def __init__(self, auth_tokens): u'refresh_token': auth_tokens.refreshToken, u'expires_in': expires_at - time.time() } - self.auth = NeptuneAuth( - OAuth2Session( - client_id=client_name, - token=token, - auto_refresh_url=refresh_url, - auto_refresh_kwargs={'client_id': client_name}, - token_updater=_no_token_updater)) + session = OAuth2Session( + client_id=client_name, + token=token, + auto_refresh_url=refresh_url, + auto_refresh_kwargs={'client_id': client_name}, + token_updater=_no_token_updater + ) + session.verify = ssl_verify + self.auth = NeptuneAuth(session) def matches(self, url): return True diff --git a/tests/neptune/test_oauth.py b/tests/neptune/test_oauth.py index 57bf360ee..ecd384bf6 100644 --- a/tests/neptune/test_oauth.py +++ b/tests/neptune/test_oauth.py @@ -102,7 +102,7 @@ def test_apply_oauth2_session_to_request(self, time_mock, session_mock): session.token = dict() # and - neptune_authenticator = NeptuneAuthenticator(auth_tokens) + neptune_authenticator = NeptuneAuthenticator(auth_tokens, False) request = a_request() # when