def _get_auth(self, ims_host, ims_endpoint_jwt,
tech_acct_id=None, api_key=None, client_secret=None,
private_key_file=None, private_key_data=None,
**kwargs):
tech_acct_id = tech_acct_id or kwargs.get("tech_acct")
private_key_file = private_key_file or kwargs.get("priv_key_path")
if not (tech_acct_id and api_key and client_secret and (private_key_data or private_key_file)):
raise ArgumentError("Connector create: not all required auth parameters were supplied; please see docs")
if private_key_data:
jwt = JWT(self.org_id, tech_acct_id, ims_host, api_key, six.StringIO(private_key_data))
else:
with open(private_key_file, 'r') as private_key_stream:
jwt = JWT(self.org_id, tech_acct_id, ims_host, api_key, private_key_stream)
token = AccessRequest("https://" + ims_host + ims_endpoint_jwt, api_key, client_secret, jwt())
return Auth(api_key, token())
评论列表
文章目录