swarmauri_auth_idp_okta 0.2.0.dev5__tar.gz → 0.11.0.dev2__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_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/PKG-INFO +16 -13
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/README.md +10 -9
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/pyproject.toml +6 -4
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOAuth20AppClient.py +2 -1
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOAuth20Login.py +3 -1
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOAuth21AppClient.py +13 -4
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOAuth21Login.py +6 -2
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOAuthLoginMixin.py +3 -1
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOIDC10AppClient.py +7 -2
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOIDC10Login.py +6 -2
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/OktaOIDCLoginMixin.py +5 -1
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/LICENSE +0 -0
- {swarmauri_auth_idp_okta-0.2.0.dev5 → swarmauri_auth_idp_okta-0.11.0.dev2}/swarmauri_auth_idp_okta/__init__.py +0 -0
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_auth_idp_okta
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev2
|
|
4
4
|
Summary: Okta OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity provider implementations for Swarmauri
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: swarmauri,sdk,experimental,identity,oauth2,oauth21,oidc,okta,idp
|
|
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">
|
|
34
|
+
<a href="https://pepy.tech/project/swarmauri_auth_idp_okta/">
|
|
35
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_okta/month" alt="PyPI - Downloads"/></a>
|
|
36
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_okta/">
|
|
37
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_okta.svg"/></a>
|
|
32
38
|
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
33
|
-
<img src="https://img.shields.io/
|
|
34
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_okta/">
|
|
35
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_okta.svg"/></a>
|
|
36
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
37
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_okta" alt="PyPI - Python Version"/></a>
|
|
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_okta/">
|
|
39
41
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_okta" alt="PyPI - License"/></a>
|
|
40
42
|
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
41
43
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_okta?label=swarmauri_auth_idp_okta&color=green" alt="PyPI - swarmauri_auth_idp_okta"/></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 Okta
|
|
47
48
|
|
|
@@ -145,3 +146,5 @@ To contribute to swarmauri-sdk, review the
|
|
|
145
146
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
146
147
|
which cover development workflow, testing, and coding standards.
|
|
147
148
|
|
|
149
|
+
|
|
150
|
+
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_auth_idp_okta/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_okta/month" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_okta/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_okta.svg"/></a>
|
|
4
8
|
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
5
|
-
<img src="https://img.shields.io/
|
|
6
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_okta/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_okta.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
9
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_okta" alt="PyPI - Python Version"/></a>
|
|
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_okta/">
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_okta" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_auth_idp_okta/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_okta?label=swarmauri_auth_idp_okta&color=green" alt="PyPI - swarmauri_auth_idp_okta"/></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 Okta
|
|
19
18
|
|
|
@@ -116,3 +115,5 @@ tenant-specific token endpoints.
|
|
|
116
115
|
To contribute to swarmauri-sdk, review the
|
|
117
116
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
118
117
|
which cover development workflow, testing, and coding standards.
|
|
118
|
+
|
|
119
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_auth_idp_okta"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev2"
|
|
4
4
|
description = "Okta OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity provider implementations for Swarmauri"
|
|
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",
|
|
@@ -13,7 +13,8 @@ from swarmauri_base.auth_idp import OAuth20AppClientBase, RetryingAsyncClient
|
|
|
13
13
|
|
|
14
14
|
@ComponentBase.register_type(OAuth20AppClientBase, "OktaOAuth20AppClient")
|
|
15
15
|
class OktaOAuth20AppClient(OAuth20AppClientBase):
|
|
16
|
-
"""Request machine-to-machine access tokens from an Okta authorization
|
|
16
|
+
"""Request machine-to-machine access tokens from an Okta authorization
|
|
17
|
+
server."""
|
|
17
18
|
|
|
18
19
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
|
19
20
|
|
|
@@ -18,7 +18,9 @@ class OktaOAuth20Login(OktaOAuthLoginMixin, OAuth20LoginBase):
|
|
|
18
18
|
payload = await self._auth_payload()
|
|
19
19
|
return {"url": payload["url"], "state": payload["state"]}
|
|
20
20
|
|
|
21
|
-
async def exchange_and_identity(
|
|
21
|
+
async def exchange_and_identity(
|
|
22
|
+
self, code: str, state: str
|
|
23
|
+
) -> Mapping[str, Any]:
|
|
22
24
|
tokens = await self._exchange_tokens(code, state)
|
|
23
25
|
profile = await self._fetch_userinfo(tokens["access_token"])
|
|
24
26
|
subject = (
|
|
@@ -18,7 +18,8 @@ ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
|
|
|
18
18
|
|
|
19
19
|
@ComponentBase.register_type(OAuth21AppClientBase, "OktaOAuth21AppClient")
|
|
20
20
|
class OktaOAuth21AppClient(OAuth21AppClientBase):
|
|
21
|
-
"""Request OAuth 2.1 tokens from Okta using secrets or private key JWT
|
|
21
|
+
"""Request OAuth 2.1 tokens from Okta using secrets or private key JWT
|
|
22
|
+
assertions."""
|
|
22
23
|
|
|
23
24
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
|
24
25
|
|
|
@@ -38,10 +39,16 @@ class OktaOAuth21AppClient(OAuth21AppClientBase):
|
|
|
38
39
|
return f"{self.issuer.rstrip('/')}/v1/token"
|
|
39
40
|
|
|
40
41
|
def _client_secret_value(self) -> Optional[str]:
|
|
41
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
self.client_secret.get_secret_value()
|
|
44
|
+
if self.client_secret
|
|
45
|
+
else None
|
|
46
|
+
)
|
|
42
47
|
|
|
43
48
|
@staticmethod
|
|
44
|
-
def _load_private_key(
|
|
49
|
+
def _load_private_key(
|
|
50
|
+
jwk_payload: Mapping[str, Any], algorithm: str
|
|
51
|
+
) -> Any:
|
|
45
52
|
serialized = json.dumps(jwk_payload)
|
|
46
53
|
if algorithm.upper().startswith("ES"):
|
|
47
54
|
return jwt.algorithms.ECAlgorithm.from_jwk(serialized)
|
|
@@ -86,7 +93,9 @@ class OktaOAuth21AppClient(OAuth21AppClientBase):
|
|
|
86
93
|
else:
|
|
87
94
|
secret = self._client_secret_value()
|
|
88
95
|
if not secret:
|
|
89
|
-
raise ValueError(
|
|
96
|
+
raise ValueError(
|
|
97
|
+
"client_secret or private_key_jwk must be provided"
|
|
98
|
+
)
|
|
90
99
|
auth = (self.client_id, secret)
|
|
91
100
|
payload = form
|
|
92
101
|
async with self.http_client_factory() as client:
|
|
@@ -18,7 +18,9 @@ class OktaOAuth21Login(OktaOIDCLoginMixin, OAuth21LoginBase):
|
|
|
18
18
|
payload = await self._auth_payload()
|
|
19
19
|
return {"url": payload["url"], "state": payload["state"]}
|
|
20
20
|
|
|
21
|
-
async def exchange_and_identity(
|
|
21
|
+
async def exchange_and_identity(
|
|
22
|
+
self, code: str, state: str
|
|
23
|
+
) -> Mapping[str, Any]:
|
|
22
24
|
tokens = await self._exchange_tokens(code, state)
|
|
23
25
|
metadata = await self._metadata()
|
|
24
26
|
claims = await self._decode_id_token(tokens, metadata)
|
|
@@ -26,6 +28,8 @@ class OktaOAuth21Login(OktaOIDCLoginMixin, OAuth21LoginBase):
|
|
|
26
28
|
"issuer": "okta-oauth21",
|
|
27
29
|
"sub": claims["sub"],
|
|
28
30
|
"email": claims.get("email"),
|
|
29
|
-
"name": claims.get("name")
|
|
31
|
+
"name": claims.get("name")
|
|
32
|
+
or claims.get("preferred_username")
|
|
33
|
+
or "Unknown",
|
|
30
34
|
"raw": {"tokens": tokens, "claims": claims},
|
|
31
35
|
}
|
|
@@ -63,7 +63,9 @@ class OktaOAuthLoginMixin:
|
|
|
63
63
|
)
|
|
64
64
|
return {"url": url, "state": state, "verifier": verifier}
|
|
65
65
|
|
|
66
|
-
async def _exchange_tokens(
|
|
66
|
+
async def _exchange_tokens(
|
|
67
|
+
self, code: str, state: str
|
|
68
|
+
) -> Mapping[str, Any]:
|
|
67
69
|
payload = verify_state(self._state_secret_value(), state)
|
|
68
70
|
metadata = await self._metadata()
|
|
69
71
|
form = {
|
|
@@ -13,7 +13,9 @@ from swarmauri_base.auth_idp import OIDC10AppClientBase, RetryingAsyncClient
|
|
|
13
13
|
|
|
14
14
|
@ComponentBase.register_type(OIDC10AppClientBase, "OktaOIDC10AppClient")
|
|
15
15
|
class OktaOIDC10AppClient(OIDC10AppClientBase):
|
|
16
|
-
"""
|
|
16
|
+
"""
|
|
17
|
+
Request machine-to-machine tokens using Okta's OIDC discovery metadata.
|
|
18
|
+
"""
|
|
17
19
|
|
|
18
20
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
|
19
21
|
|
|
@@ -48,7 +50,10 @@ class OktaOIDC10AppClient(OIDC10AppClientBase):
|
|
|
48
50
|
response.raise_for_status()
|
|
49
51
|
payload: Mapping[str, Any] = response.json()
|
|
50
52
|
if self.discovery_cache_ttl_seconds > 0:
|
|
51
|
-
self._discovery_cache = (
|
|
53
|
+
self._discovery_cache = (
|
|
54
|
+
payload,
|
|
55
|
+
now + self.discovery_cache_ttl_seconds,
|
|
56
|
+
)
|
|
52
57
|
return payload
|
|
53
58
|
|
|
54
59
|
async def _fetch_token(self, scope: Optional[str]) -> Tuple[str, float]:
|
|
@@ -23,8 +23,12 @@ class OktaOIDC10Login(OktaOIDCLoginMixin, OIDC10LoginBase):
|
|
|
23
23
|
metadata = await self._metadata()
|
|
24
24
|
claims = await self._decode_id_token(tokens, metadata)
|
|
25
25
|
email = claims.get("email")
|
|
26
|
-
name =
|
|
27
|
-
|
|
26
|
+
name = (
|
|
27
|
+
claims.get("name") or claims.get("preferred_username") or "Unknown"
|
|
28
|
+
)
|
|
29
|
+
if (not email or name == "Unknown") and metadata.get(
|
|
30
|
+
"userinfo_endpoint"
|
|
31
|
+
):
|
|
28
32
|
profile = await self._fetch_userinfo(tokens["access_token"])
|
|
29
33
|
email = profile.get("email") or email
|
|
30
34
|
name = profile.get("name") or profile.get("given_name") or name
|
|
@@ -31,7 +31,11 @@ class OktaOIDCLoginMixin(OktaOAuthLoginMixin):
|
|
|
31
31
|
response.raise_for_status()
|
|
32
32
|
jwks = response.json()
|
|
33
33
|
key_entry = next(
|
|
34
|
-
(
|
|
34
|
+
(
|
|
35
|
+
entry
|
|
36
|
+
for entry in jwks.get("keys", [])
|
|
37
|
+
if entry.get("kid") == kid
|
|
38
|
+
),
|
|
35
39
|
None,
|
|
36
40
|
)
|
|
37
41
|
if not key_entry:
|
|
File without changes
|
|
File without changes
|