swarmauri_auth_idp_azure 0.2.0.dev5__tar.gz → 0.11.0.dev1__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.
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/PKG-INFO +14 -11
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/README.md +8 -7
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/pyproject.toml +6 -4
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/swarmauri_auth_idp_azure/AzureLoginMixin.py +6 -2
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/swarmauri_auth_idp_azure/AzureOAuth20Login.py +6 -2
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/swarmauri_auth_idp_azure/AzureOAuth21Login.py +6 -2
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/swarmauri_auth_idp_azure/AzureOIDC10Login.py +15 -4
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/LICENSE +0 -0
- {swarmauri_auth_idp_azure-0.2.0.dev5 → swarmauri_auth_idp_azure-0.11.0.dev1}/swarmauri_auth_idp_azure/__init__.py +0 -0
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_auth_idp_azure
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
4
|
Summary: Azure Active Directory OAuth 2.0 / 2.1 / OIDC 1.0 login implementations for Swarmauri deployments
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: swarmauri,sdk,standards,identity,oauth2,oauth21,oidc,azure,microsoft
|
|
8
8
|
Author: Jacob Stewart
|
|
9
9
|
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.
|
|
10
|
+
Requires-Python: >=3.10,<3.15
|
|
11
11
|
Classifier: Development Status :: 1 - Planning
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
14
|
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
15
17
|
Classifier: Programming Language :: Python
|
|
16
18
|
Classifier: Programming Language :: Python :: 3
|
|
17
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier:
|
|
22
|
-
Classifier:
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
25
|
Requires-Dist: httpx (>=0.27)
|
|
24
26
|
Requires-Dist: pyjwt[crypto] (>=2.8)
|
|
25
27
|
Requires-Dist: swarmauri_base
|
|
26
28
|
Requires-Dist: swarmauri_core
|
|
27
29
|
Description-Content-Type: text/markdown
|
|
28
30
|
|
|
29
|
-

|
|
30
32
|
|
|
31
33
|
<p align="center">
|
|
32
|
-
<a href="https://
|
|
33
|
-
<img src="https://
|
|
34
|
+
<a href="https://pepy.tech/project/swarmauri_auth_idp_azure/">
|
|
35
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_azure/month" alt="PyPI - Downloads"/></a>
|
|
34
36
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_azure/">
|
|
35
37
|
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_azure.svg"/></a>
|
|
36
38
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
37
|
-
<img src="https://img.shields.io/
|
|
39
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
38
40
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
39
41
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_azure" alt="PyPI - License"/></a>
|
|
40
42
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
41
43
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_azure?label=swarmauri_auth_idp_azure&color=green" alt="PyPI - swarmauri_auth_idp_azure"/></a>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
---
|
|
44
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
45
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
45
46
|
|
|
46
47
|
# Swarmauri Auth IDP Azure AD
|
|
47
48
|
|
|
@@ -111,3 +112,5 @@ To contribute to swarmauri-sdk, review the
|
|
|
111
112
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
112
113
|
which cover development workflow, testing, and coding standards.
|
|
113
114
|
|
|
115
|
+
|
|
116
|
+
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://
|
|
5
|
-
<img src="https://
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_auth_idp_azure/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_azure/month" alt="PyPI - Downloads"/></a>
|
|
6
6
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_azure/">
|
|
7
7
|
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_azure.svg"/></a>
|
|
8
8
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
9
|
-
<img src="https://img.shields.io/
|
|
9
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
10
10
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_azure" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_auth_idp_azure/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_azure?label=swarmauri_auth_idp_azure&color=green" alt="PyPI - swarmauri_auth_idp_azure"/></a>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
---
|
|
14
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
15
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
17
16
|
|
|
18
17
|
# Swarmauri Auth IDP Azure AD
|
|
19
18
|
|
|
@@ -82,3 +81,5 @@ print(login.client_id)
|
|
|
82
81
|
To contribute to swarmauri-sdk, review the
|
|
83
82
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
84
83
|
which cover development workflow, testing, and coding standards.
|
|
84
|
+
|
|
85
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_auth_idp_azure"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
4
|
description = "Azure Active Directory OAuth 2.0 / 2.1 / OIDC 1.0 login implementations for Swarmauri deployments"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
|
-
requires-python = ">=3.10,<3.
|
|
7
|
+
requires-python = ">=3.10,<3.15"
|
|
8
8
|
repository = "https://github.com/swarmauri/swarmauri-sdk"
|
|
9
9
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
10
10
|
classifiers = [
|
|
@@ -12,14 +12,16 @@ classifiers = [
|
|
|
12
12
|
"Intended Audience :: Developers",
|
|
13
13
|
"License :: OSI Approved :: Apache Software License",
|
|
14
14
|
"Natural Language :: English",
|
|
15
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
16
|
+
"Topic :: Security :: Cryptography",
|
|
15
17
|
"Programming Language :: Python",
|
|
16
18
|
"Programming Language :: Python :: 3",
|
|
17
19
|
"Programming Language :: Python :: 3 :: Only",
|
|
18
20
|
"Programming Language :: Python :: 3.10",
|
|
19
21
|
"Programming Language :: Python :: 3.11",
|
|
20
22
|
"Programming Language :: Python :: 3.12",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
23
25
|
]
|
|
24
26
|
keywords = [
|
|
25
27
|
"swarmauri",
|
|
@@ -50,7 +50,9 @@ class AzureLoginMixin:
|
|
|
50
50
|
def _token_endpoint(self) -> str:
|
|
51
51
|
return f"{self._authority_base()}/token"
|
|
52
52
|
|
|
53
|
-
async def _auth_payload(
|
|
53
|
+
async def _auth_payload(
|
|
54
|
+
self, *, prompt: str | None = None
|
|
55
|
+
) -> Dict[str, str]:
|
|
54
56
|
verifier, challenge = make_pkce_pair()
|
|
55
57
|
state = sign_state(
|
|
56
58
|
self._state_secret(),
|
|
@@ -76,7 +78,9 @@ class AzureLoginMixin:
|
|
|
76
78
|
response.raise_for_status()
|
|
77
79
|
return response.json()
|
|
78
80
|
|
|
79
|
-
async def _exchange_tokens(
|
|
81
|
+
async def _exchange_tokens(
|
|
82
|
+
self, code: str, state: str
|
|
83
|
+
) -> Mapping[str, Any]:
|
|
80
84
|
payload = verify_state(self._state_secret(), state)
|
|
81
85
|
form = {
|
|
82
86
|
"grant_type": "authorization_code",
|
|
@@ -20,14 +20,18 @@ class AzureOAuth20Login(AzureLoginMixin, OAuth20LoginBase):
|
|
|
20
20
|
payload = await self._auth_payload()
|
|
21
21
|
return {"url": payload["url"], "state": payload["state"]}
|
|
22
22
|
|
|
23
|
-
async def exchange_and_identity(
|
|
23
|
+
async def exchange_and_identity(
|
|
24
|
+
self, code: str, state: str
|
|
25
|
+
) -> Mapping[str, Any]:
|
|
24
26
|
tokens = await self._exchange_tokens(code, state)
|
|
25
27
|
access_token = tokens.get("access_token")
|
|
26
28
|
profile: Mapping[str, Any] = {}
|
|
27
29
|
if access_token:
|
|
28
30
|
profile = await self._fetch_profile(access_token)
|
|
29
31
|
email = (
|
|
30
|
-
profile.get("mail") or profile.get("userPrincipalName")
|
|
32
|
+
profile.get("mail") or profile.get("userPrincipalName")
|
|
33
|
+
if profile
|
|
34
|
+
else None
|
|
31
35
|
)
|
|
32
36
|
name = profile.get("displayName") if profile else None
|
|
33
37
|
return {
|
|
@@ -20,14 +20,18 @@ class AzureOAuth21Login(AzureLoginMixin, OAuth21LoginBase):
|
|
|
20
20
|
payload = await self._auth_payload(prompt="select_account")
|
|
21
21
|
return {"url": payload["url"], "state": payload["state"]}
|
|
22
22
|
|
|
23
|
-
async def exchange_and_identity(
|
|
23
|
+
async def exchange_and_identity(
|
|
24
|
+
self, code: str, state: str
|
|
25
|
+
) -> Mapping[str, Any]:
|
|
24
26
|
tokens = await self._exchange_tokens(code, state)
|
|
25
27
|
access_token = tokens.get("access_token")
|
|
26
28
|
profile: Mapping[str, Any] = {}
|
|
27
29
|
if access_token:
|
|
28
30
|
profile = await self._fetch_profile(access_token)
|
|
29
31
|
email = (
|
|
30
|
-
profile.get("mail") or profile.get("userPrincipalName")
|
|
32
|
+
profile.get("mail") or profile.get("userPrincipalName")
|
|
33
|
+
if profile
|
|
34
|
+
else None
|
|
31
35
|
)
|
|
32
36
|
name = profile.get("displayName") if profile else None
|
|
33
37
|
return {
|
|
@@ -19,7 +19,9 @@ from swarmauri_base.auth_idp import (
|
|
|
19
19
|
|
|
20
20
|
@ComponentBase.register_type(OIDC10LoginBase, "AzureOIDC10Login")
|
|
21
21
|
class AzureOIDC10Login(OIDC10LoginBase):
|
|
22
|
-
"""
|
|
22
|
+
"""
|
|
23
|
+
Azure AD confidential client OIDC login using authorization code + PKCE.
|
|
24
|
+
"""
|
|
23
25
|
|
|
24
26
|
model_config = ConfigDict(extra="forbid")
|
|
25
27
|
|
|
@@ -109,7 +111,12 @@ class AzureOIDC10Login(OIDC10LoginBase):
|
|
|
109
111
|
if not kid:
|
|
110
112
|
raise ValueError("kid missing from id_token header")
|
|
111
113
|
key = next(
|
|
112
|
-
(
|
|
114
|
+
(
|
|
115
|
+
entry
|
|
116
|
+
for entry in jwks.get("keys", [])
|
|
117
|
+
if entry.get("kid") == kid
|
|
118
|
+
),
|
|
119
|
+
None,
|
|
113
120
|
)
|
|
114
121
|
if key is None:
|
|
115
122
|
raise ValueError("signing key not found for id_token")
|
|
@@ -145,9 +152,13 @@ class AzureOIDC10Login(OIDC10LoginBase):
|
|
|
145
152
|
expected_issuer=metadata["issuer"],
|
|
146
153
|
)
|
|
147
154
|
email = (
|
|
148
|
-
claims.get("email") or claims.get("preferred_username")
|
|
155
|
+
claims.get("email") or claims.get("preferred_username")
|
|
156
|
+
if claims
|
|
157
|
+
else None
|
|
158
|
+
)
|
|
159
|
+
name = (
|
|
160
|
+
claims.get("name") or claims.get("given_name") if claims else None
|
|
149
161
|
)
|
|
150
|
-
name = claims.get("name") or claims.get("given_name") if claims else None
|
|
151
162
|
return {
|
|
152
163
|
"issuer": "azure-oidc10",
|
|
153
164
|
"tokens": tokens,
|
|
File without changes
|
|
File without changes
|