microsoft-agents-authentication-msal 0.5.0.dev5__py3-none-any.whl → 0.5.0.dev7__py3-none-any.whl
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.5.0.dev7.dist-info/METADATA +134 -0
- {microsoft_agents_authentication_msal-0.5.0.dev5.dist-info → microsoft_agents_authentication_msal-0.5.0.dev7.dist-info}/RECORD +5 -5
- microsoft_agents_authentication_msal-0.5.0.dev5.dist-info/METADATA +0 -17
- {microsoft_agents_authentication_msal-0.5.0.dev5.dist-info → microsoft_agents_authentication_msal-0.5.0.dev7.dist-info}/WHEEL +0 -0
- {microsoft_agents_authentication_msal-0.5.0.dev5.dist-info → microsoft_agents_authentication_msal-0.5.0.dev7.dist-info}/licenses/LICENSE +0 -0
- {microsoft_agents_authentication_msal-0.5.0.dev5.dist-info → microsoft_agents_authentication_msal-0.5.0.dev7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft-agents-authentication-msal
|
|
3
|
+
Version: 0.5.0.dev7
|
|
4
|
+
Summary: A msal-based authentication library for Microsoft Agents
|
|
5
|
+
Author: Microsoft Corporation
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: microsoft-agents-hosting-core==0.5.0.dev7
|
|
14
|
+
Requires-Dist: msal>=1.31.1
|
|
15
|
+
Requires-Dist: requests>=2.32.3
|
|
16
|
+
Requires-Dist: cryptography>=44.0.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
|
|
20
|
+
# Microsoft Agents MSAL Authentication
|
|
21
|
+
|
|
22
|
+
[](https://pypi.org/project/microsoft-agents-authentication-msal/)
|
|
23
|
+
|
|
24
|
+
Provides secure authentication for your agents using Microsoft Authentication Library (MSAL). It handles getting tokens from Azure AD so your agent can securely communicate with Microsoft services like Teams, Graph API, and other Azure resources.
|
|
25
|
+
|
|
26
|
+
# What is this?
|
|
27
|
+
|
|
28
|
+
This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehensive framework for building enterprise-grade conversational AI agents. The SDK enables developers to create intelligent agents that work across multiple platforms including Microsoft Teams, M365 Copilot, Copilot Studio, and web chat, with support for third-party integrations like Slack, Facebook Messenger, and Twilio.
|
|
29
|
+
|
|
30
|
+
## Packages Overview
|
|
31
|
+
|
|
32
|
+
We offer the following PyPI packages to create conversational experiences based on Agents:
|
|
33
|
+
|
|
34
|
+
| Package Name | PyPI Version | Description |
|
|
35
|
+
|--------------|-------------|-------------|
|
|
36
|
+
| `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. |
|
|
37
|
+
| `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. |
|
|
38
|
+
| `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. |
|
|
39
|
+
| `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. |
|
|
40
|
+
| `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. |
|
|
41
|
+
| `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. |
|
|
42
|
+
| `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | MSAL-based authentication for Microsoft Agents. |
|
|
43
|
+
|
|
44
|
+
Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:
|
|
45
|
+
|
|
46
|
+
| Package Name | PyPI Version | Description |
|
|
47
|
+
|--------------|-------------|-------------|
|
|
48
|
+
| `microsoft-agents-copilotstudio-client` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | Direct to Engine client to interact with Agents created in CopilotStudio |
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install microsoft-agents-authentication-msal
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Basic Setup with Client Secret
|
|
59
|
+
|
|
60
|
+
Define your client secrets in the ENV file
|
|
61
|
+
```python
|
|
62
|
+
CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTID=client-id
|
|
63
|
+
CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTSECRET=client-secret
|
|
64
|
+
CONNECTIONS__SERVICE_CONNECTION__SETTINGS__TENANTID=tenant-id
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Load the Configuration (Code from [main.py Quickstart Sample](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/src/main.py))
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from .start_server import start_server
|
|
71
|
+
|
|
72
|
+
start_server(
|
|
73
|
+
agent_application=AGENT_APP,
|
|
74
|
+
auth_configuration=CONNECTION_MANAGER.get_default_connection_configuration(),
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
Then start the Agent (code snipped from (start_server.py Quickstart Sample](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/src/start_server.py)):
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
def start_server(
|
|
81
|
+
agent_application: AgentApplication, auth_configuration: AgentAuthConfiguration
|
|
82
|
+
):
|
|
83
|
+
async def entry_point(req: Request) -> Response:
|
|
84
|
+
agent: AgentApplication = req.app["agent_app"]
|
|
85
|
+
adapter: CloudAdapter = req.app["adapter"]
|
|
86
|
+
return await start_agent_process(
|
|
87
|
+
req,
|
|
88
|
+
agent,
|
|
89
|
+
adapter,
|
|
90
|
+
)
|
|
91
|
+
[...]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Authentication Types
|
|
95
|
+
The M365 Agents SDK in Python supports the following Auth types:
|
|
96
|
+
```python
|
|
97
|
+
class AuthTypes(str, Enum):
|
|
98
|
+
certificate = "certificate"
|
|
99
|
+
certificate_subject_name = "CertificateSubjectName"
|
|
100
|
+
client_secret = "ClientSecret"
|
|
101
|
+
user_managed_identity = "UserManagedIdentity"
|
|
102
|
+
system_managed_identity = "SystemManagedIdentity"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Key Classes
|
|
106
|
+
|
|
107
|
+
- **`MsalAuth`** - Core authentication provider using MSAL
|
|
108
|
+
- **`MsalConnectionManager`** - Manages multiple authentication connections
|
|
109
|
+
|
|
110
|
+
## Features
|
|
111
|
+
|
|
112
|
+
✅ **Multiple auth types** - Client secret, certificate, managed identity
|
|
113
|
+
✅ **Token caching** - Automatic token refresh and caching
|
|
114
|
+
✅ **Multi-tenant** - Support for different Azure AD tenants
|
|
115
|
+
✅ **Agent-to-agent** - Secure communication between agents
|
|
116
|
+
✅ **On-behalf-of** - Act on behalf of users
|
|
117
|
+
|
|
118
|
+
# Security Best Practices
|
|
119
|
+
|
|
120
|
+
- Store secrets in Azure Key Vault or environment variables
|
|
121
|
+
- Use managed identities when possible (no secrets to manage)
|
|
122
|
+
- Regularly rotate client secrets and certificates
|
|
123
|
+
- Use least-privilege principle for scopes and permissions
|
|
124
|
+
|
|
125
|
+
# Quick Links
|
|
126
|
+
|
|
127
|
+
- 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents)
|
|
128
|
+
- 📖 [Complete Documentation](https://aka.ms/agents)
|
|
129
|
+
- 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python)
|
|
130
|
+
- 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues)
|
|
131
|
+
|
|
132
|
+
# Sample Applications
|
|
133
|
+
|
|
134
|
+
w
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
microsoft_agents/authentication/msal/__init__.py,sha256=hjPpakL4zyqeCTEBOUCcHaRnSpG80q-L0csG5HMalYI,151
|
|
2
2
|
microsoft_agents/authentication/msal/msal_auth.py,sha256=A5CuO-JY7g03tzuuLPeKzUUQ-fsg9PLMwNe_2k7U_pY,15337
|
|
3
3
|
microsoft_agents/authentication/msal/msal_connection_manager.py,sha256=v7o0ONzjId1G6Ta7IjHc1NtSeM3NWH4t7YilrwJzvYg,5713
|
|
4
|
-
microsoft_agents_authentication_msal-0.5.0.
|
|
5
|
-
microsoft_agents_authentication_msal-0.5.0.
|
|
6
|
-
microsoft_agents_authentication_msal-0.5.0.
|
|
7
|
-
microsoft_agents_authentication_msal-0.5.0.
|
|
8
|
-
microsoft_agents_authentication_msal-0.5.0.
|
|
4
|
+
microsoft_agents_authentication_msal-0.5.0.dev7.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
5
|
+
microsoft_agents_authentication_msal-0.5.0.dev7.dist-info/METADATA,sha256=iFExC01NLb8ucXq96YD7_mQoUdO7ADuA2owz_4tDB4s,6412
|
|
6
|
+
microsoft_agents_authentication_msal-0.5.0.dev7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
microsoft_agents_authentication_msal-0.5.0.dev7.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
|
|
8
|
+
microsoft_agents_authentication_msal-0.5.0.dev7.dist-info/RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: microsoft-agents-authentication-msal
|
|
3
|
-
Version: 0.5.0.dev5
|
|
4
|
-
Summary: A msal-based authentication library for Microsoft Agents
|
|
5
|
-
Author: Microsoft Corporation
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.9
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: microsoft-agents-hosting-core==0.5.0.dev5
|
|
13
|
-
Requires-Dist: msal>=1.31.1
|
|
14
|
-
Requires-Dist: requests>=2.32.3
|
|
15
|
-
Requires-Dist: cryptography>=44.0.0
|
|
16
|
-
Dynamic: license-file
|
|
17
|
-
Dynamic: requires-dist
|
|
File without changes
|
|
File without changes
|