Merge pull request #36 from dod-ccpo/validate-certs
turn off service SSL cert validation by default for development
This commit is contained in:
commit
b622572cdf
@ -5,9 +5,10 @@ from json import dumps, loads
|
||||
|
||||
class ApiClient(object):
|
||||
|
||||
def __init__(self, base_url):
|
||||
def __init__(self, base_url, validate_cert=True):
|
||||
self.base_url = base_url
|
||||
self.client = AsyncHTTPClient()
|
||||
self.validate_cert = validate_cert
|
||||
|
||||
@tornado.gen.coroutine
|
||||
def get(self, path, **kwargs):
|
||||
@ -35,6 +36,8 @@ class ApiClient(object):
|
||||
headers = kwargs.get('headers', {})
|
||||
headers['Content-Type'] = 'application/json'
|
||||
kwargs['headers'] = headers
|
||||
if not 'validate_cert' in kwargs:
|
||||
kwargs['validate_cert'] = self.validate_cert
|
||||
|
||||
response = yield self.client.fetch(url, method=method, **kwargs)
|
||||
return self.adapt_response(response)
|
||||
|
@ -69,10 +69,12 @@ def make_app(config, deps, **kwargs):
|
||||
|
||||
|
||||
def make_deps(config):
|
||||
# we do not want to do SSL verify services in test and development
|
||||
validate_cert = ENV == 'production'
|
||||
return {
|
||||
'authz_client': ApiClient(config["default"]["AUTHZ_BASE_URL"]),
|
||||
'authnid_client': ApiClient(config["default"]["AUTHNID_BASE_URL"]),
|
||||
'requests_client': ApiClient(config["default"]["REQUESTS_QUEUE_BASE_URL"])
|
||||
'authz_client': ApiClient(config["default"]["AUTHZ_BASE_URL"], validate_cert=validate_cert),
|
||||
'authnid_client': ApiClient(config["default"]["AUTHNID_BASE_URL"], validate_cert=validate_cert),
|
||||
'requests_client': ApiClient(config["default"]["REQUESTS_QUEUE_BASE_URL"], validate_cert=validate_cert)
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user