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

Commit e9a471e

Browse files
authored
Merge pull request #242 from AzureAD/release-1.2.5
Release 1.2.5
2 parents 2471809 + ae1eb0e commit e9a471e

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: A template reminding ADAL's status
3+
about: So that people are guided to use MSAL Python instead.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
This library, ADAL for Python, will no longer receive new feature improvements. Instead, use the new library [MSAL for Python](https://github.com/AzureAD/microsoft-authentication-library-for-python).
11+
12+
* If you are starting a new project, you can get started with the MSAL Python docs for details about the scenarios, usage, and relevant concepts.
13+
* If your application is using the previous ADAL Python library, you can follow this migration guide to update to MSAL Python.
14+
* Existing applications relying on ADAL Python will continue to work.
15+
16+
---
17+
18+
If you encounter a bug, please reproduce it using our off-the-shelf
19+
[samples](https://github.com/AzureAD/azure-activedirectory-library-for-python/tree/1.2.4/sample), so that we can follow your steps.

adal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# pylint: disable=wrong-import-position
2929

30-
__version__ = '1.2.4'
30+
__version__ = '1.2.5'
3131

3232
import logging
3333

adal/token_request.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ def _perform_wstrust_assertion_oauth_exchange(self, wstrust_response):
190190

191191
return self._oauth_get_token(oauth_parameters)
192192

193-
def _perform_wstrust_exchange(self, wstrust_endpoint, wstrust_endpoint_version, username, password):
193+
def _perform_wstrust_exchange(self, wstrust_endpoint, wstrust_endpoint_version, cloud_audience_urn, username, password):
194194

195-
wstrust = self._create_wstrust_request(wstrust_endpoint, "urn:federation:MicrosoftOnline",
195+
wstrust = self._create_wstrust_request(wstrust_endpoint, cloud_audience_urn,
196196
wstrust_endpoint_version)
197197
result = wstrust.acquire_token(username, password)
198198

@@ -204,15 +204,16 @@ def _perform_wstrust_exchange(self, wstrust_endpoint, wstrust_endpoint_version,
204204

205205
return result
206206

207-
def _perform_username_password_for_access_token_exchange(self, wstrust_endpoint, wstrust_endpoint_version,
207+
def _perform_username_password_for_access_token_exchange(self, wstrust_endpoint, wstrust_endpoint_version, cloud_audience_urn,
208208
username, password):
209-
wstrust_response = self._perform_wstrust_exchange(wstrust_endpoint, wstrust_endpoint_version,
209+
wstrust_response = self._perform_wstrust_exchange(wstrust_endpoint, wstrust_endpoint_version, cloud_audience_urn,
210210
username, password)
211211
return self._perform_wstrust_assertion_oauth_exchange(wstrust_response)
212212

213213
def _get_token_username_password_federated(self, username, password):
214214
self._log.debug("Acquiring token with username password for federated user")
215215

216+
cloud_audience_urn = self._user_realm.cloud_audience_urn
216217
if not self._user_realm.federation_metadata_url:
217218
self._log.warn("Unable to retrieve federationMetadataUrl from AAD. "
218219
"Attempting fallback to AAD supplied endpoint.")
@@ -228,7 +229,7 @@ def _get_token_username_password_federated(self, username, password):
228229

229230
return self._perform_username_password_for_access_token_exchange(
230231
self._user_realm.federation_active_auth_url,
231-
wstrust_version, username, password)
232+
wstrust_version, cloud_audience_urn, username, password)
232233
else:
233234
mex_endpoint = self._user_realm.federation_metadata_url
234235
self._log.debug(
@@ -253,6 +254,7 @@ def _get_token_username_password_federated(self, username, password):
253254
raise AdalError('AAD did not return a WSTrust endpoint. Unable to proceed.')
254255

255256
return self._perform_username_password_for_access_token_exchange(wstrust_endpoint, wstrust_version,
257+
cloud_audience_urn,
256258
username, password)
257259
@staticmethod
258260
def _parse_wstrust_version_from_federation_active_authurl(federation_active_authurl):

adal/user_realm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self, call_context, user_principle, authority_url):
5757
self.account_type = None
5858
self.federation_metadata_url = None
5959
self.federation_active_auth_url = None
60+
self.cloud_audience_urn = None
6061
self._user_principle = user_principle
6162
self._authority_url = authority_url
6263

@@ -131,6 +132,7 @@ def _parse_discovery_response(self, body):
131132
self.federation_protocol = protocol
132133
self.federation_metadata_url = response['federation_metadata_url']
133134
self.federation_active_auth_url = response['federation_active_auth_url']
135+
self.cloud_audience_urn = response.get('cloud_audience_urn', "urn:federation:MicrosoftOnline")
134136

135137
self._log_parsed_response()
136138

adal/wstrust_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141

4242
class WSTrustRequest(object):
4343

44-
def __init__(self, call_context, watrust_endpoint_url, applies_to, wstrust_endpoint_version):
44+
def __init__(self, call_context, wstrust_endpoint_url, applies_to, wstrust_endpoint_version):
4545
self._log = log.Logger('WSTrustRequest', call_context['log_context'])
4646
self._call_context = call_context
47-
self._wstrust_endpoint_url = watrust_endpoint_url
47+
self._wstrust_endpoint_url = wstrust_endpoint_url
4848
self._applies_to = applies_to
4949
self._wstrust_endpoint_version = wstrust_endpoint_version
5050

0 commit comments

Comments
 (0)