microsoft-agents-authentication-msal 0.4.0.dev6__tar.gz → 0.4.0.dev10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/PKG-INFO +2 -2
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents_authentication_msal.egg-info/PKG-INFO +2 -2
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents_authentication_msal.egg-info/SOURCES.txt +1 -3
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents_authentication_msal.egg-info/requires.txt +1 -1
- microsoft_agents_authentication_msal-0.4.0.dev6/tests/test_msal_auth.py +0 -83
- microsoft_agents_authentication_msal-0.4.0.dev6/tests/test_msal_connection_manager.py +0 -35
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents/authentication/msal/__init__.py +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents/authentication/msal/msal_auth.py +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents/authentication/msal/msal_connection_manager.py +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents_authentication_msal.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/microsoft_agents_authentication_msal.egg-info/top_level.txt +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/pyproject.toml +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/setup.cfg +0 -0
- {microsoft_agents_authentication_msal-0.4.0.dev6 → microsoft_agents_authentication_msal-0.4.0.dev10}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-authentication-msal
|
|
3
|
-
Version: 0.4.0.
|
|
3
|
+
Version: 0.4.0.dev10
|
|
4
4
|
Summary: A msal-based authentication library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
|
-
Requires-Dist: microsoft-agents-hosting-core==0.4.0.
|
|
11
|
+
Requires-Dist: microsoft-agents-hosting-core==0.4.0.dev10
|
|
12
12
|
Requires-Dist: msal>=1.31.1
|
|
13
13
|
Requires-Dist: requests>=2.32.3
|
|
14
14
|
Requires-Dist: cryptography>=44.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-authentication-msal
|
|
3
|
-
Version: 0.4.0.
|
|
3
|
+
Version: 0.4.0.dev10
|
|
4
4
|
Summary: A msal-based authentication library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.9
|
|
11
|
-
Requires-Dist: microsoft-agents-hosting-core==0.4.0.
|
|
11
|
+
Requires-Dist: microsoft-agents-hosting-core==0.4.0.dev10
|
|
12
12
|
Requires-Dist: msal>=1.31.1
|
|
13
13
|
Requires-Dist: requests>=2.32.3
|
|
14
14
|
Requires-Dist: cryptography>=44.0.0
|
|
@@ -7,6 +7,4 @@ microsoft_agents_authentication_msal.egg-info/PKG-INFO
|
|
|
7
7
|
microsoft_agents_authentication_msal.egg-info/SOURCES.txt
|
|
8
8
|
microsoft_agents_authentication_msal.egg-info/dependency_links.txt
|
|
9
9
|
microsoft_agents_authentication_msal.egg-info/requires.txt
|
|
10
|
-
microsoft_agents_authentication_msal.egg-info/top_level.txt
|
|
11
|
-
tests/test_msal_auth.py
|
|
12
|
-
tests/test_msal_connection_manager.py
|
|
10
|
+
microsoft_agents_authentication_msal.egg-info/top_level.txt
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
from unittest.mock import Mock
|
|
3
|
-
import pytest
|
|
4
|
-
from msal import ManagedIdentityClient, ConfidentialClientApplication
|
|
5
|
-
from microsoft_agents.authentication.msal import MsalAuth
|
|
6
|
-
from microsoft_agents.hosting.core.authorization import AgentAuthConfiguration
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TestingMsalAuth(MsalAuth):
|
|
10
|
-
"""
|
|
11
|
-
Mock object for MsalAuth
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
def __init__(self, client_type):
|
|
15
|
-
super().__init__(AgentAuthConfiguration())
|
|
16
|
-
mock_client = Mock(spec=client_type)
|
|
17
|
-
|
|
18
|
-
mock_client.acquire_token_for_client = Mock(
|
|
19
|
-
return_value={"access_token": "token"}
|
|
20
|
-
)
|
|
21
|
-
mock_client.acquire_token_on_behalf_of = Mock(
|
|
22
|
-
return_value={"access_token": "token"}
|
|
23
|
-
)
|
|
24
|
-
self.mock_client = mock_client
|
|
25
|
-
|
|
26
|
-
self._create_client_application = Mock(return_value=self.mock_client)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class TestMsalAuth:
|
|
30
|
-
"""
|
|
31
|
-
Test suite for testing MsalAuth functionality
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
@pytest.mark.asyncio
|
|
35
|
-
async def test_get_access_token_managed_identity(self):
|
|
36
|
-
mock_auth = TestingMsalAuth(ManagedIdentityClient)
|
|
37
|
-
token = await mock_auth.get_access_token(
|
|
38
|
-
"https://test.api.botframework.com", scopes=["test-scope"]
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
assert token == "token"
|
|
42
|
-
mock_auth.mock_client.acquire_token_for_client.assert_called_with(
|
|
43
|
-
resource="https://test.api.botframework.com"
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
@pytest.mark.asyncio
|
|
47
|
-
async def test_get_access_token_confidential(self):
|
|
48
|
-
mock_auth = TestingMsalAuth(ConfidentialClientApplication)
|
|
49
|
-
token = await mock_auth.get_access_token(
|
|
50
|
-
"https://test.api.botframework.com", scopes=["test-scope"]
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
assert token == "token"
|
|
54
|
-
mock_auth.mock_client.acquire_token_for_client.assert_called_with(
|
|
55
|
-
scopes=["test-scope"]
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
@pytest.mark.asyncio
|
|
59
|
-
async def test_aquire_token_on_behalf_of_managed_identity(self):
|
|
60
|
-
mock_auth = TestingMsalAuth(ManagedIdentityClient)
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
await mock_auth.aquire_token_on_behalf_of(
|
|
64
|
-
scopes=["test-scope"], user_assertion="test-assertion"
|
|
65
|
-
)
|
|
66
|
-
except NotImplementedError:
|
|
67
|
-
assert True
|
|
68
|
-
else:
|
|
69
|
-
assert False
|
|
70
|
-
|
|
71
|
-
@pytest.mark.asyncio
|
|
72
|
-
async def test_aquire_token_on_behalf_of_confidential(self):
|
|
73
|
-
mock_auth = TestingMsalAuth(ConfidentialClientApplication)
|
|
74
|
-
mock_auth._create_client_application = Mock(return_value=mock_auth.mock_client)
|
|
75
|
-
|
|
76
|
-
token = await mock_auth.aquire_token_on_behalf_of(
|
|
77
|
-
scopes=["test-scope"], user_assertion="test-assertion"
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
assert token == "token"
|
|
81
|
-
mock_auth.mock_client.acquire_token_on_behalf_of.assert_called_with(
|
|
82
|
-
scopes=["test-scope"], user_assertion="test-assertion"
|
|
83
|
-
)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
from os import environ
|
|
2
|
-
from microsoft_agents.activity import load_configuration_from_env
|
|
3
|
-
from microsoft_agents.hosting.core import AuthTypes
|
|
4
|
-
from microsoft_agents.authentication.msal import MsalConnectionManager
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class TestMsalConnectionManager:
|
|
8
|
-
"""
|
|
9
|
-
Test suite for the Msal Connection Manager
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
def test_msal_connection_manager(self):
|
|
13
|
-
mock_environ = {
|
|
14
|
-
**environ,
|
|
15
|
-
"CONNECTIONS__SERVICE_CONNECTION__SETTINGS__TENANTID": "test-tenant-id-SERVICE_CONNECTION",
|
|
16
|
-
"CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTID": "test-client-id-SERVICE_CONNECTION",
|
|
17
|
-
"CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTSECRET": "test-client-secret-SERVICE_CONNECTION",
|
|
18
|
-
"CONNECTIONS__MCS__SETTINGS__TENANTID": "test-tenant-id-MCS",
|
|
19
|
-
"CONNECTIONS__MCS__SETTINGS__CLIENTID": "test-client-id-MCS",
|
|
20
|
-
"CONNECTIONS__MCS__SETTINGS__CLIENTSECRET": "test-client-secret-MCS",
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
config = load_configuration_from_env(mock_environ)
|
|
24
|
-
connection_manager = MsalConnectionManager(**config)
|
|
25
|
-
for key in connection_manager._connections:
|
|
26
|
-
auth = connection_manager.get_connection(key)._msal_configuration
|
|
27
|
-
assert auth.AUTH_TYPE == AuthTypes.client_secret
|
|
28
|
-
assert auth.CLIENT_ID == f"test-client-id-{key}"
|
|
29
|
-
assert auth.TENANT_ID == f"test-tenant-id-{key}"
|
|
30
|
-
assert auth.CLIENT_SECRET == f"test-client-secret-{key}"
|
|
31
|
-
assert auth.ISSUERS == [
|
|
32
|
-
"https://api.botframework.com",
|
|
33
|
-
f"https://sts.windows.net/test-tenant-id-{key}/",
|
|
34
|
-
f"https://login.microsoftonline.com/test-tenant-id-{key}/v2.0",
|
|
35
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|