swarmauri_auth_idp_gitlab 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_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/PKG-INFO +16 -13
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/README.md +10 -9
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/pyproject.toml +6 -4
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOAuth20Login.py +3 -1
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOAuth21AppClient.py +11 -3
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOAuth21Login.py +5 -2
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOAuthLoginMixin.py +6 -2
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOIDC10AppClient.py +2 -1
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOIDCLoginMixin.py +12 -4
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/LICENSE +0 -0
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOAuth20AppClient.py +0 -0
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/GitLabOIDC10Login.py +0 -0
- {swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/swarmauri_auth_idp_gitlab/__init__.py +0 -0
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_auth_idp_gitlab
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev2
|
|
4
4
|
Summary: GitLab 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,gitlab,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_gitlab/">
|
|
35
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_gitlab/month" alt="PyPI - Downloads"/></a>
|
|
36
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_gitlab/">
|
|
37
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_gitlab.svg"/></a>
|
|
32
38
|
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
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_gitlab/">
|
|
35
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_gitlab.svg"/></a>
|
|
36
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
37
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_gitlab" 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_gitlab/">
|
|
39
41
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_gitlab" alt="PyPI - License"/></a>
|
|
40
42
|
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
41
43
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_gitlab?label=swarmauri_auth_idp_gitlab&color=green" alt="PyPI - swarmauri_auth_idp_gitlab"/></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 GitLab
|
|
47
48
|
|
|
@@ -121,3 +122,5 @@ To contribute to swarmauri-sdk, review the
|
|
|
121
122
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
122
123
|
which cover development workflow, testing, and coding standards.
|
|
123
124
|
|
|
125
|
+
|
|
126
|
+
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_auth_idp_gitlab/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_auth_idp_gitlab/month" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_gitlab/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_gitlab.svg"/></a>
|
|
4
8
|
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
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_gitlab/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_gitlab.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
9
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_gitlab" 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_gitlab/">
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_gitlab" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_auth_idp_gitlab/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_gitlab?label=swarmauri_auth_idp_gitlab&color=green" alt="PyPI - swarmauri_auth_idp_gitlab"/></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 GitLab
|
|
19
18
|
|
|
@@ -92,3 +91,5 @@ asyncio.run(run_flow())
|
|
|
92
91
|
To contribute to swarmauri-sdk, review the
|
|
93
92
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
94
93
|
which cover development workflow, testing, and coding standards.
|
|
94
|
+
|
|
95
|
+
|
{swarmauri_auth_idp_gitlab-0.2.0.dev5 → swarmauri_auth_idp_gitlab-0.11.0.dev2}/pyproject.toml
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_auth_idp_gitlab"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev2"
|
|
4
4
|
description = "GitLab 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",
|
|
@@ -18,7 +18,9 @@ class GitLabOAuth20Login(GitLabOAuthLoginMixin, 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_profile(tokens["access_token"])
|
|
24
26
|
return {
|
|
@@ -36,7 +36,11 @@ class GitLabOAuth21AppClient(OAuth21AppClientBase):
|
|
|
36
36
|
return f"{self.base_url.rstrip('/')}/oauth/token"
|
|
37
37
|
|
|
38
38
|
def _client_secret_value(self) -> Optional[str]:
|
|
39
|
-
return
|
|
39
|
+
return (
|
|
40
|
+
self.client_secret.get_secret_value()
|
|
41
|
+
if self.client_secret
|
|
42
|
+
else None
|
|
43
|
+
)
|
|
40
44
|
|
|
41
45
|
@staticmethod
|
|
42
46
|
def _load_private_key(jwk_payload: Dict[str, Any], algorithm: str) -> Any:
|
|
@@ -66,7 +70,9 @@ class GitLabOAuth21AppClient(OAuth21AppClientBase):
|
|
|
66
70
|
payload, key=key, algorithm=algorithm, headers=headers or None
|
|
67
71
|
)
|
|
68
72
|
return {
|
|
69
|
-
"client_assertion_type":
|
|
73
|
+
"client_assertion_type": (
|
|
74
|
+
"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
|
|
75
|
+
),
|
|
70
76
|
"client_assertion": assertion,
|
|
71
77
|
}
|
|
72
78
|
|
|
@@ -81,7 +87,9 @@ class GitLabOAuth21AppClient(OAuth21AppClientBase):
|
|
|
81
87
|
else:
|
|
82
88
|
secret = self._client_secret_value()
|
|
83
89
|
if not secret:
|
|
84
|
-
raise ValueError(
|
|
90
|
+
raise ValueError(
|
|
91
|
+
"client_secret or private_key_jwk must be provided"
|
|
92
|
+
)
|
|
85
93
|
auth = (self.client_id, secret)
|
|
86
94
|
payload = {**form, **body}
|
|
87
95
|
async with self.http_client_factory() as client:
|
|
@@ -12,13 +12,16 @@ from .GitLabOIDCLoginMixin import GitLabOIDCLoginMixin
|
|
|
12
12
|
|
|
13
13
|
@ComponentBase.register_type(OAuth21LoginBase, "GitLabOAuth21Login")
|
|
14
14
|
class GitLabOAuth21Login(GitLabOIDCLoginMixin, OAuth21LoginBase):
|
|
15
|
-
"""Implement the GitLab OAuth 2.1 Authorization Code flow via OIDC
|
|
15
|
+
"""Implement the GitLab OAuth 2.1 Authorization Code flow via OIDC
|
|
16
|
+
discovery."""
|
|
16
17
|
|
|
17
18
|
async def auth_url(self) -> Mapping[str, str]:
|
|
18
19
|
payload = await self._auth_payload()
|
|
19
20
|
return {"url": payload["url"], "state": payload["state"]}
|
|
20
21
|
|
|
21
|
-
async def exchange_and_identity(
|
|
22
|
+
async def exchange_and_identity(
|
|
23
|
+
self, code: str, state: str
|
|
24
|
+
) -> Mapping[str, Any]:
|
|
22
25
|
result = await self._exchange_tokens(code, state)
|
|
23
26
|
tokens = result["tokens"]
|
|
24
27
|
claims = result["claims"]
|
|
@@ -56,7 +56,9 @@ class GitLabOAuthLoginMixin:
|
|
|
56
56
|
)
|
|
57
57
|
return {"url": url, "state": state, "verifier": verifier}
|
|
58
58
|
|
|
59
|
-
async def _exchange_tokens(
|
|
59
|
+
async def _exchange_tokens(
|
|
60
|
+
self, code: str, state: str
|
|
61
|
+
) -> Mapping[str, Any]:
|
|
60
62
|
payload = verify_state(self._state_secret_value(), state)
|
|
61
63
|
form = {
|
|
62
64
|
"grant_type": "authorization_code",
|
|
@@ -82,7 +84,9 @@ class GitLabOAuthLoginMixin:
|
|
|
82
84
|
}
|
|
83
85
|
api_base = self._api_base_url()
|
|
84
86
|
async with self.http_client_factory() as client:
|
|
85
|
-
response = await client.get_retry(
|
|
87
|
+
response = await client.get_retry(
|
|
88
|
+
f"{api_base}/user", headers=headers
|
|
89
|
+
)
|
|
86
90
|
response.raise_for_status()
|
|
87
91
|
profile = response.json()
|
|
88
92
|
email = profile.get("public_email") or profile.get("email")
|
|
@@ -14,7 +14,8 @@ from swarmauri_base.auth_idp.http import RetryingAsyncClient
|
|
|
14
14
|
|
|
15
15
|
@ComponentBase.register_type(OIDC10AppClientBase, "GitLabOIDC10AppClient")
|
|
16
16
|
class GitLabOIDC10AppClient(OIDC10AppClientBase):
|
|
17
|
-
"""Request client credentials tokens using GitLab's OIDC discovery
|
|
17
|
+
"""Request client credentials tokens using GitLab's OIDC discovery
|
|
18
|
+
metadata."""
|
|
18
19
|
|
|
19
20
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
|
20
21
|
|
|
@@ -16,7 +16,9 @@ from swarmauri_base.auth_idp import (
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class GitLabOIDCLoginMixin:
|
|
19
|
-
"""
|
|
19
|
+
"""
|
|
20
|
+
Reusable discovery, PKCE, and ID token helpers for GitLab OIDC logins.
|
|
21
|
+
"""
|
|
20
22
|
|
|
21
23
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
|
22
24
|
|
|
@@ -63,7 +65,9 @@ class GitLabOIDCLoginMixin:
|
|
|
63
65
|
)
|
|
64
66
|
return {"url": url, "state": state, "verifier": verifier}
|
|
65
67
|
|
|
66
|
-
async def _exchange_tokens(
|
|
68
|
+
async def _exchange_tokens(
|
|
69
|
+
self, code: str, state: str
|
|
70
|
+
) -> Mapping[str, Any]:
|
|
67
71
|
payload = verify_state(self._state_secret_value(), state)
|
|
68
72
|
metadata = await self._metadata()
|
|
69
73
|
form = {
|
|
@@ -96,7 +100,7 @@ class GitLabOIDCLoginMixin:
|
|
|
96
100
|
userinfo_response = await client.get_retry(
|
|
97
101
|
metadata["userinfo_endpoint"],
|
|
98
102
|
headers={
|
|
99
|
-
"Authorization": f"Bearer {tokens['access_token']}",
|
|
103
|
+
"Authorization": f"Bearer {tokens['access_token']}", # noqa: E501
|
|
100
104
|
"Accept": "application/json",
|
|
101
105
|
},
|
|
102
106
|
)
|
|
@@ -119,7 +123,11 @@ class GitLabOIDCLoginMixin:
|
|
|
119
123
|
if not kid:
|
|
120
124
|
raise ValueError("missing kid in id_token header")
|
|
121
125
|
key_entry = next(
|
|
122
|
-
(
|
|
126
|
+
(
|
|
127
|
+
entry
|
|
128
|
+
for entry in jwks.get("keys", [])
|
|
129
|
+
if entry.get("kid") == kid
|
|
130
|
+
),
|
|
123
131
|
None,
|
|
124
132
|
)
|
|
125
133
|
if not key_entry:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|