Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Authentication context

Navya Canumalla edited this page Jun 1, 2018 · 2 revisions

The AuthenticationContext in ADAL Python represents a connection to Azure AD. You can create an instance of the AuthenticationContext class as follows:

from adal import AuthenticationContext

context = AuthenticationContext(authority_url, validate_authority=None, cache=None, api_version=None, timeout=None, enable_pii=False)
  • authority_url - The URL of the authority from which you want to request tokens for resources. You can think of the authority as the directory issuing the identities/tokens. The URL is composed of https:///, where 'instance' is the Azure AD host(such as https://login.microsoftonline.com) and 'tenant' is the domain name (such as contoso.onmicrosoft.com) or tenant ID of the directory.

  • validate_authority - ADAL will validate the given authority before sending requests if this flag is enabled. By default, this is set to true. It is recommended to validate authority when dynamically setting an authority value for requests.

  • cache - This allows you to set a custom token cache for this instance of the AuthenticationContext. If not set, the default token cache in ADAL is used.

  • api_version - This parameter is deprecated in v1.0. For historical reasons, the default value in the library is None.

  • timeout - This is the time the library waits for response from the server before giving up. Set the value as a float, or a (connect timeout, read timeout) tuple.

  • enable_pii - By default, ADAL does not log any PII. You can set this to true to enable PII logging.