Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_empty_adal_object():
context = log.create_log_context()
component = 'TEST'
logger = log.Logger(component, context)
call_context = {'log_context' : context }
adal_object = { 'log' : logger, 'call_context' : call_context }
return adal_object
def test_logging(self):
log_capture_string = StringIO()
handler = logging.StreamHandler(log_capture_string)
util.turn_on_logging(handler=handler)
test_logger = adal_logging.Logger("TokenRequest", {'correlation_id':'12345'})
test_logger.warn('a warning', log_stack_trace=True)
log_contents = log_capture_string.getvalue()
logging.getLogger(adal_logging.ADAL_LOGGER_NAME).removeHandler(handler)
self.assertTrue('12345 - TokenRequest:a warning' in log_contents and 'Stack:' in log_contents)
def __init__(self, call_context, user_principle, authority_url):
self._log = log.Logger("UserRealm", call_context['log_context'])
self._call_context = call_context
self.api_version = '1.0'
self.federation_protocol = None
self.account_type = None
self.federation_metadata_url = None
self.federation_active_auth_url = None
self._user_principle = user_principle
self._authority_url = authority_url
def __init__(self, call_context, response, wstrust_version):
self._log = log.Logger("WSTrustResponse", call_context['log_context'])
self._call_context = call_context
self._response = response
self._dom = None
self._parents = None
self.error_code = None
self.fault_message = None
self.token_type = None
self.token = None
self._wstrust_version = wstrust_version
if response:
self._log.debug(scrub_rstr_log_message(response))
def __init__(self, call_context, authentication_context, client_id,
resource, redirect_uri=None):
self._log = log.Logger("TokenRequest", call_context['log_context'])
self._call_context = call_context
self._authentication_context = authentication_context
self._resource = resource
self._client_id = client_id
self._redirect_uri = redirect_uri
self._cache_driver = None
# should be set at the beginning of get_token
# functions that have a user_id
self._user_id = None
self._user_realm = None
# should be set when acquire token using device flow
self._polling_client = None