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

ADAL Python 1.0.0 (was Release Candidate 1.0.0rc1) #137

Merged
merged 2 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# pylint: disable=wrong-import-position

__version__ = '0.7.0'
__version__ = '1.0.0'

import logging

Expand Down
6 changes: 3 additions & 3 deletions adal/authentication_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AuthenticationContext(object):

def __init__(
self, authority, validate_authority=None, cache=None,
api_version='1.0', timeout=None, enable_pii=False, verify_ssl=None, proxies=None):
api_version=None, timeout=None, enable_pii=False, verify_ssl=None, proxies=None):
'''Creates a new AuthenticationContext object.

By default the authority will be checked against a list of known Azure
Expand All @@ -68,9 +68,9 @@ def __init__(
AuthenticationContexts.
:param api_version: (optional) Specifies API version using on the wire.
Historically it has a hardcoded default value as "1.0".
Developers are now encouraged to set it as None explicitly,
Developers have been encouraged to set it as None explicitly,
which means the underlying API version will be automatically chosen.
In next major release, this default value will be changed to None.
Starting from ADAL Python 1.0, this default value becomes None.
:param timeout: (optional) requests timeout. How long to wait for the server to send
data before giving up, as a float, or a `(connect timeout,
read timeout) <timeouts>` tuple.
Expand Down
2 changes: 1 addition & 1 deletion sample/certificate_credentials_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_private_key(filename):
turn_on_logging()

### Main logic begins
context = adal.AuthenticationContext(authority_url, api_version=None)
context = adal.AuthenticationContext(authority_url)
key = get_private_key(sample_parameters['privateKeyFile'])

token = context.acquire_token_with_client_certificate(
Expand Down
2 changes: 1 addition & 1 deletion sample/client_credentials_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def turn_on_logging():
### Main logic begins
context = adal.AuthenticationContext(
authority_url, validate_authority=sample_parameters['tenant'] != 'adfs',
api_version=None)
)

token = context.acquire_token_with_client_credentials(
RESOURCE,
Expand Down
2 changes: 1 addition & 1 deletion sample/device_code_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def turn_on_logging():
#turn_on_logging()

### Main logic begins
context = adal.AuthenticationContext(authority_url, api_version=None)
context = adal.AuthenticationContext(authority_url)
code = context.acquire_user_code(RESOURCE, clientid)
print(code['message'])
token = context.acquire_token_with_device_code(RESOURCE, code, clientid)
Expand Down
2 changes: 1 addition & 1 deletion sample/refresh_token_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def turn_on_logging():
### Main logic begins
context = adal.AuthenticationContext(
authority_url, validate_authority=sample_parameters['tenant'] != 'adfs',
api_version=None)
)

token = context.acquire_token_with_username_password(
RESOURCE,
Expand Down
4 changes: 2 additions & 2 deletions sample/website_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def do_GET(self):
token_response = self._acquire_token()
message = 'response: ' + json.dumps(token_response)
#Later, if the access token is expired it can be refreshed.
auth_context = AuthenticationContext(authority_url, api_version=None)
auth_context = AuthenticationContext(authority_url)
token_response = auth_context.acquire_token_with_refresh_token(
token_response['refreshToken'],
sample_parameters['clientId'],
Expand All @@ -109,7 +109,7 @@ def _acquire_token(self):
if state != cookie['auth_state'].value:
raise ValueError('state does not match')
### Main logic begins
auth_context = AuthenticationContext(authority_url, api_version=None)
auth_context = AuthenticationContext(authority_url)
return auth_context.acquire_token_with_authorization_code(
code,
REDIRECT_URI,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_api_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def test_api_version_default_value(self):
warnings.simplefilter("always")
context = adal.AuthenticationContext(
"https://login.windows.net/tenant")
self.assertEqual(context._call_context['api_version'], '1.0')
self.assertEqual(context._call_context['api_version'], None)
self.assertEqual(len(caught_warnings), 0)
if len(caught_warnings) == 1:
# It should be len(caught_warnings)==1, but somehow it works on
# all my local test environment but not on Travis-CI.
Expand Down
2 changes: 1 addition & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def val_exists(val):
def match_standard_request_headers(mock_request):
matches = []
matches.append(mock_request.headers.get('x-client-SKU', None) == 'Python')
matches.append(mock_request.headers.get('x-client-Ver', "").startswith('0.'))
assert mock_request.headers.get('x-client-Ver') is not None
matches.append(mock_request.headers.get('x-client-OS', None) != None)
matches.append(mock_request.headers.get('x-client-CPU', None) != None)
request_id = correlation_id_regex.match(mock_request.headers.get('client-request-id'))
Expand Down