swarmauri_auth_idp_google 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.
@@ -1,47 +1,48 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: swarmauri_auth_idp_google
3
- Version: 0.2.0.dev5
3
+ Version: 0.11.0.dev2
4
4
  Summary: Google 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,google,idp
8
8
  Author: Jacob Stewart
9
9
  Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
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: Topic :: Internet :: WWW/HTTP
22
- Classifier: Topic :: Security :: Cryptography
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
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/master/assets/swarmauri.brand.theme.svg)
31
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
30
32
 
31
33
  <p align="center">
34
+ <a href="https://pepy.tech/project/swarmauri_auth_idp_google/">
35
+ <img src="https://static.pepy.tech/badge/swarmauri_auth_idp_google/month" alt="PyPI - Downloads"/></a>
36
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_google/">
37
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_google.svg"/></a>
32
38
  <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
33
- <img src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_google" alt="PyPI - Downloads"/></a>
34
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_google/">
35
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_google.svg"/></a>
36
- <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
37
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_google" 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_google/">
39
41
  <img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_google" alt="PyPI - License"/></a>
40
42
  <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
41
43
  <img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_google?label=swarmauri_auth_idp_google&color=green" alt="PyPI - swarmauri_auth_idp_google"/></a>
42
- </p>
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 Google
47
48
 
@@ -116,3 +117,5 @@ To contribute to swarmauri-sdk, review the
116
117
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
117
118
  which cover development workflow, testing, and coding standards.
118
119
 
120
+
121
+
@@ -1,19 +1,18 @@
1
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/master/assets/swarmauri.brand.theme.svg)
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
2
 
3
3
  <p align="center">
4
+ <a href="https://pepy.tech/project/swarmauri_auth_idp_google/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_auth_idp_google/month" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_google/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_auth_idp_google.svg"/></a>
4
8
  <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_google" alt="PyPI - Downloads"/></a>
6
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_google/">
7
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_google.svg"/></a>
8
- <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
9
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_google" 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_google/">
11
11
  <img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_google" alt="PyPI - License"/></a>
12
12
  <a href="https://pypi.org/project/swarmauri_auth_idp_google/">
13
13
  <img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_google?label=swarmauri_auth_idp_google&color=green" alt="PyPI - swarmauri_auth_idp_google"/></a>
14
- </p>
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 Google
19
18
 
@@ -87,3 +86,5 @@ asyncio.run(run_flow())
87
86
  To contribute to swarmauri-sdk, review the
88
87
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
89
88
  which cover development workflow, testing, and coding standards.
89
+
90
+
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "swarmauri_auth_idp_google"
3
- version = "0.2.0.dev5"
3
+ version = "0.11.0.dev2"
4
4
  description = "Google 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.13"
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
- "Topic :: Internet :: WWW/HTTP",
22
- "Topic :: Security :: Cryptography",
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 GoogleOAuth20Login(GoogleOAuthLoginMixin, 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(self, code: str, state: str) -> Mapping[str, Any]:
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 {
@@ -18,7 +18,9 @@ class GoogleOAuth21Login(GoogleOIDCLoginMixin, 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(self, code: str, state: str) -> Mapping[str, Any]:
21
+ async def exchange_and_identity(
22
+ self, code: str, state: str
23
+ ) -> Mapping[str, Any]:
22
24
  result = await self._exchange_tokens(code, state)
23
25
  tokens = result["tokens"]
24
26
  claims = result["claims"]
@@ -15,7 +15,9 @@ from swarmauri_base.auth_idp import (
15
15
 
16
16
  GOOGLE_AUTHORIZATION_ENDPOINT = "https://accounts.google.com/o/oauth2/v2/auth"
17
17
  GOOGLE_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token"
18
- GOOGLE_USERINFO_ENDPOINT = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"
18
+ GOOGLE_USERINFO_ENDPOINT = (
19
+ "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"
20
+ )
19
21
  GOOGLE_DEFAULT_SCOPE = (
20
22
  "https://www.googleapis.com/auth/userinfo.email "
21
23
  "https://www.googleapis.com/auth/userinfo.profile"
@@ -54,7 +56,9 @@ class GoogleOAuthLoginMixin:
54
56
  )
55
57
  return {"url": url, "state": state, "verifier": verifier}
56
58
 
57
- async def _exchange_tokens(self, code: str, state: str) -> Mapping[str, Any]:
59
+ async def _exchange_tokens(
60
+ self, code: str, state: str
61
+ ) -> Mapping[str, Any]:
58
62
  payload = verify_state(self._state_secret_value(), state)
59
63
  form = {
60
64
  "grant_type": "authorization_code",
@@ -79,7 +83,9 @@ class GoogleOAuthLoginMixin:
79
83
  "Accept": "application/json",
80
84
  }
81
85
  async with self.http_client_factory() as client:
82
- response = await client.get_retry(GOOGLE_USERINFO_ENDPOINT, headers=headers)
86
+ response = await client.get_retry(
87
+ GOOGLE_USERINFO_ENDPOINT, headers=headers
88
+ )
83
89
  response.raise_for_status()
84
90
  return response.json()
85
91
 
@@ -57,7 +57,8 @@ class GoogleOIDCLoginMixin:
57
57
  if self.discovery_cache is None:
58
58
  async with self.http_client_factory() as client:
59
59
  response = await client.get_retry(
60
- self.discovery_endpoint, headers={"Accept": "application/json"}
60
+ self.discovery_endpoint,
61
+ headers={"Accept": "application/json"},
61
62
  )
62
63
  response.raise_for_status()
63
64
  self.discovery_cache = response.json()
@@ -78,9 +79,16 @@ class GoogleOIDCLoginMixin:
78
79
  f"&code_challenge={challenge}&code_challenge_method=S256"
79
80
  f"&include_granted_scopes=true&prompt=select_account"
80
81
  )
81
- return {"url": url, "state": state, "verifier": verifier, "nonce": nonce}
82
+ return {
83
+ "url": url,
84
+ "state": state,
85
+ "verifier": verifier,
86
+ "nonce": nonce,
87
+ }
82
88
 
83
- async def _exchange_tokens(self, code: str, state: str) -> Mapping[str, Any]:
89
+ async def _exchange_tokens(
90
+ self, code: str, state: str
91
+ ) -> Mapping[str, Any]:
84
92
  payload = verify_state(self._state_secret_value(), state)
85
93
  metadata = await self._metadata()
86
94
  form = {
@@ -113,7 +121,7 @@ class GoogleOIDCLoginMixin:
113
121
  userinfo_response = await client.get_retry(
114
122
  metadata["userinfo_endpoint"],
115
123
  headers={
116
- "Authorization": f"Bearer {tokens['access_token']}",
124
+ "Authorization": f"Bearer {tokens['access_token']}", # noqa: E501
117
125
  "Accept": "application/json",
118
126
  },
119
127
  )
@@ -136,7 +144,11 @@ class GoogleOIDCLoginMixin:
136
144
  if not kid:
137
145
  raise ValueError("missing kid in id_token header")
138
146
  key_entry = next(
139
- (entry for entry in jwks.get("keys", []) if entry.get("kid") == kid),
147
+ (
148
+ entry
149
+ for entry in jwks.get("keys", [])
150
+ if entry.get("kid") == kid
151
+ ),
140
152
  None,
141
153
  )
142
154
  if not key_entry: