Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cbe98f3
Initial commit
abhidnya13 Feb 25, 2020
e64332f
Iteration 1
abhidnya13 Mar 5, 2020
2a7d5e3
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 Mar 5, 2020
aed0e8d
Iteration 2 rectifying tests
abhidnya13 Mar 6, 2020
30f7d99
Iteration 3 modifying some more failing tests
abhidnya13 Mar 6, 2020
34e8e16
Iteration 4
abhidnya13 Mar 7, 2020
f60bbb5
Removing tests whose implementation was removed
abhidnya13 Mar 7, 2020
d54fb8b
Iteration 5
abhidnya13 Mar 7, 2020
be389d5
Replacing generic exception to specific Http error
abhidnya13 Mar 9, 2020
dcec4af
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 Mar 16, 2020
e37f0c3
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 Mar 16, 2020
b3a4e09
Refactor according to new interface
abhidnya13 Mar 20, 2020
96988f8
Changing one reference to new interface left in the previous one
abhidnya13 Mar 20, 2020
1d05615
Modified one more missed change
abhidnya13 Mar 20, 2020
ccafcf9
Few more changes and refactor
abhidnya13 Mar 20, 2020
2670e25
Adding raw response to response object
abhidnya13 Mar 20, 2020
cb70a37
Cleaning None values
abhidnya13 Mar 23, 2020
53520fd
PR review iteration
abhidnya13 Mar 26, 2020
293b081
Removing default http client
abhidnya13 Mar 30, 2020
fcac05e
cleaning up
abhidnya13 Mar 30, 2020
229ad26
Adding deleted single empty line back
abhidnya13 Mar 30, 2020
340210f
Updating filtering of non values from dictionary
abhidnya13 Mar 30, 2020
ca8a129
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 Apr 7, 2020
d993950
Capturing editorial changes
abhidnya13 Apr 13, 2020
e5ebd28
Review changes 1
abhidnya13 Apr 16, 2020
8901269
Fixing broken test
abhidnya13 Apr 16, 2020
7774be8
Cleaning up
abhidnya13 Apr 16, 2020
42ca7a2
PR review changes part 1
abhidnya13 Apr 17, 2020
d38d38d
PR review changes part 2
abhidnya13 Apr 17, 2020
3226bc4
PR review changes part 3
abhidnya13 Apr 17, 2020
90afb94
Minor indent change
abhidnya13 Apr 17, 2020
a1ce0d1
PR review changes part 4
abhidnya13 Apr 20, 2020
ad245a7
Adding back accidentally deleted blank line
abhidnya13 Apr 20, 2020
34bb127
Removing extra indent
abhidnya13 Apr 20, 2020
a745949
Minor line add in authority.py
abhidnya13 Apr 20, 2020
b636baa
Making changes for backward compatibility
abhidnya13 Apr 20, 2020
d24d575
Some more editorial changes
abhidnya13 Apr 21, 2020
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
Prev Previous commit
Next Next commit
Capturing editorial changes
  • Loading branch information
abhidnya13 committed Apr 13, 2020
commit d993950cf0b7b66ff530902fdfc60e30dbdd97c9
14 changes: 9 additions & 5 deletions msal/application.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import requests
import time
try: # Python 2
from urlparse import urljoin
Expand All @@ -10,6 +9,8 @@
import warnings
import uuid

import requests

from .oauth2cli import Client, JwtAssertionCreator
from .authority import Authority
from .mex import send_request as mex_send_request
Expand Down Expand Up @@ -90,7 +91,8 @@ class ClientApplication(object):
def __init__(
self, client_id,
client_credential=None, authority=None, validate_authority=True,
token_cache=None, http_client=None,
token_cache=None,
http_client=None,
verify=True, proxies=None, timeout=None,
client_claims=None, app_name=None, app_version=None):
"""Create an instance of application.
Expand Down Expand Up @@ -140,7 +142,7 @@ def __init__(
By default, an in-memory cache will be created and used.
:param http_client: (optional)
Your implementation of abstract class HttpClient <msal.oauth2cli.http.http_client>
Defaults to default http client implementation which uses requests
Defaults to a requests session instance
:param verify: (optional)
It will be passed to the
`verify parameter in the underlying requests library
Expand Down Expand Up @@ -385,7 +387,8 @@ def _find_msal_accounts(self, environment):

def _get_authority_aliases(self, instance):
if not self.authority_groups:
resp = self.http_client.get("https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/common/oauth2/authorize",
resp = self.http_client.get(
"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/common/oauth2/authorize",
headers={'Accept': 'application/json'},
timeout=self.timeout)
resp.raise_for_status()
Expand Down Expand Up @@ -769,7 +772,8 @@ def _acquire_token_by_username_password_federated(
wstrust_endpoint = {}
if user_realm_result.get("federation_metadata_url"):
wstrust_endpoint = mex_send_request(
user_realm_result["federation_metadata_url"], http_client=self.http_client)
user_realm_result["federation_metadata_url"],
http_client=self.http_client)
if wstrust_endpoint is None:
raise ValueError("Unable to find wstrust endpoint from MEX. "
"This typically happens when attempting MSA accounts. "
Expand Down
6 changes: 3 additions & 3 deletions msal/mex.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def _xpath_of_root(route_to_leaf):


def send_request(mex_endpoint, http_client, **kwargs):
resp = http_client.get(mex_endpoint, headers={'Content-Type': 'application/soap+xml'},
**kwargs)
mex_document = resp.text
mex_document = http_client.get(
mex_endpoint, headers={'Content-Type': 'application/soap+xml'},
**kwargs).text
return Mex(mex_document).get_wstrust_username_password_endpoint()


Expand Down
3 changes: 1 addition & 2 deletions msal/wstrust_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def send_request(
"Unsupported soap action: %s" % soap_action)
data = _build_rst(
username, password, cloud_audience_urn, endpoint_address, soap_action)
resp = http_client.post(endpoint_address, data=data,
headers={
resp = http_client.post(endpoint_address, data=data, headers={
'Content-type':'application/soap+xml; charset=utf-8',
'SOAPAction': soap_action,
}, **kwargs)
Expand Down