swarmauri_auth_idp_github 0.2.0.dev5__py3-none-any.whl → 0.11.0__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.
- swarmauri_auth_idp_github/GitHubAppClientMixin.py +4 -2
- swarmauri_auth_idp_github/GitHubOAuth20Login.py +3 -1
- swarmauri_auth_idp_github/GitHubOAuth21Login.py +3 -1
- swarmauri_auth_idp_github/GitHubOAuthLoginMixin.py +42 -7
- swarmauri_auth_idp_github-0.11.0.dist-info/METADATA +411 -0
- swarmauri_auth_idp_github-0.11.0.dist-info/RECORD +13 -0
- {swarmauri_auth_idp_github-0.2.0.dev5.dist-info → swarmauri_auth_idp_github-0.11.0.dist-info}/WHEEL +1 -1
- swarmauri_auth_idp_github-0.11.0.dist-info/licenses/NOTICE +7 -0
- swarmauri_auth_idp_github-0.2.0.dev5.dist-info/METADATA +0 -120
- swarmauri_auth_idp_github-0.2.0.dev5.dist-info/RECORD +0 -12
- {swarmauri_auth_idp_github-0.2.0.dev5.dist-info → swarmauri_auth_idp_github-0.11.0.dist-info}/entry_points.txt +0 -0
- {swarmauri_auth_idp_github-0.2.0.dev5.dist-info → swarmauri_auth_idp_github-0.11.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -42,7 +42,9 @@ class GitHubAppClientMixin:
|
|
|
42
42
|
def _app_jwt(self) -> str:
|
|
43
43
|
now = int(time.time())
|
|
44
44
|
payload = {"iat": now - 60, "exp": now + 600, "iss": self.app_id}
|
|
45
|
-
return jwt.encode(
|
|
45
|
+
return jwt.encode(
|
|
46
|
+
payload, self._private_key_value(), algorithm="RS256"
|
|
47
|
+
)
|
|
46
48
|
|
|
47
49
|
def _request_payload(self) -> Dict[str, Any]:
|
|
48
50
|
payload: Dict[str, Any] = {}
|
|
@@ -51,7 +53,7 @@ class GitHubAppClientMixin:
|
|
|
51
53
|
if self.repository_ids:
|
|
52
54
|
payload["repository_ids"] = list(self.repository_ids)
|
|
53
55
|
if self.repository_names:
|
|
54
|
-
payload["
|
|
56
|
+
payload["repositories"] = list(self.repository_names)
|
|
55
57
|
return payload
|
|
56
58
|
|
|
57
59
|
@staticmethod
|
|
@@ -18,7 +18,9 @@ class GitHubOAuth20Login(GitHubOAuthLoginMixin, 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 {
|
|
@@ -18,7 +18,9 @@ class GitHubOAuth21Login(GitHubOAuthLoginMixin, 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
|
profile = await self._fetch_profile(tokens["access_token"])
|
|
24
26
|
return {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Any, Callable, Mapping
|
|
6
|
+
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
|
|
6
7
|
|
|
7
8
|
from pydantic import ConfigDict, Field, SecretBytes, SecretStr
|
|
8
9
|
|
|
@@ -51,15 +52,45 @@ class GitHubOAuthLoginMixin:
|
|
|
51
52
|
async def _auth_payload(self) -> Mapping[str, str]:
|
|
52
53
|
verifier, challenge = make_pkce_pair()
|
|
53
54
|
state = sign_state(self._state_secret_value(), {"verifier": verifier})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
endpoint = self._authorization_endpoint()
|
|
56
|
+
params = {
|
|
57
|
+
"client_id": self.client_id,
|
|
58
|
+
"redirect_uri": self.redirect_uri,
|
|
59
|
+
"scope": self.scope,
|
|
60
|
+
"state": state,
|
|
61
|
+
"code_challenge": challenge,
|
|
62
|
+
"code_challenge_method": "S256",
|
|
63
|
+
}
|
|
64
|
+
query = urlencode(params)
|
|
65
|
+
parts = urlsplit(endpoint)
|
|
66
|
+
# An endpoint that already carries one of the generated keys (a stale
|
|
67
|
+
# state or PKCE value in its query) must not emit it twice: servers
|
|
68
|
+
# that take the first value or reject duplicates break the callback
|
|
69
|
+
# exchange. Other query keys the endpoint carries are kept.
|
|
70
|
+
kept = urlencode(
|
|
71
|
+
[
|
|
72
|
+
(key, value)
|
|
73
|
+
for key, value in parse_qsl(
|
|
74
|
+
parts.query, keep_blank_values=True
|
|
75
|
+
)
|
|
76
|
+
if key not in params
|
|
77
|
+
]
|
|
78
|
+
)
|
|
79
|
+
merged_query = f"{kept}&{query}" if kept else query
|
|
80
|
+
url = urlunsplit(
|
|
81
|
+
(
|
|
82
|
+
parts.scheme,
|
|
83
|
+
parts.netloc,
|
|
84
|
+
parts.path,
|
|
85
|
+
merged_query,
|
|
86
|
+
parts.fragment,
|
|
87
|
+
)
|
|
59
88
|
)
|
|
60
89
|
return {"url": url, "state": state, "verifier": verifier}
|
|
61
90
|
|
|
62
|
-
async def _exchange_tokens(
|
|
91
|
+
async def _exchange_tokens(
|
|
92
|
+
self, code: str, state: str
|
|
93
|
+
) -> Mapping[str, Any]:
|
|
63
94
|
payload = verify_state(self._state_secret_value(), state)
|
|
64
95
|
form = {
|
|
65
96
|
"client_id": self.client_id,
|
|
@@ -108,7 +139,11 @@ class GitHubOAuthLoginMixin:
|
|
|
108
139
|
None,
|
|
109
140
|
)
|
|
110
141
|
fallback = primary or next(
|
|
111
|
-
(
|
|
142
|
+
(
|
|
143
|
+
entry
|
|
144
|
+
for entry in emails
|
|
145
|
+
if isinstance(entry, Mapping)
|
|
146
|
+
),
|
|
112
147
|
None,
|
|
113
148
|
)
|
|
114
149
|
if fallback:
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_auth_idp_github
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: swarmauri,sdk,experimental,identity,oauth2,oauth21,github,idp
|
|
9
|
+
Author: Jacob Stewart
|
|
10
|
+
Author-email: jacob@swarmauri.com
|
|
11
|
+
Requires-Python: >=3.10,<3.15
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Requires-Dist: httpx (>=0.27)
|
|
26
|
+
Requires-Dist: pyjwt[crypto] (>=2.8)
|
|
27
|
+
Requires-Dist: swarmauri_base
|
|
28
|
+
Requires-Dist: swarmauri_core
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# swarmauri_auth_idp_github
|
|
32
|
+
|
|
33
|
+
<!-- readme-standards:begin branding -->
|
|
34
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
35
|
+
<p align="center"><strong>swarmauri_auth_idp_github</strong></p>
|
|
36
|
+
<p align="center">GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri</p>
|
|
37
|
+
<p align="center">
|
|
38
|
+
<a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="pypi: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?labelColor=1E293B&color=1D4ED8"></a>
|
|
39
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.11.0&labelColor=1E293B&color=4338CA"></a>
|
|
40
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
41
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&message=standards&labelColor=1E293B&color=6D28D9"></a>
|
|
42
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
43
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
44
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
45
|
+
</p>
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="Monthly PyPI downloads: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github?labelColor=1E293B&color=0E7490"></a>
|
|
48
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md"><img alt="README hits: swarmauri_auth_idp_github" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_auth_idp_github/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
49
|
+
</p>
|
|
50
|
+
<p align="center">
|
|
51
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
52
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
53
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
54
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
55
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
56
|
+
</p>
|
|
57
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
58
|
+
<!-- readme-standards:end branding -->
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Overview
|
|
63
|
+
|
|
64
|
+
### Summary
|
|
65
|
+
|
|
66
|
+
GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
|
|
67
|
+
|
|
68
|
+
### Why This Package
|
|
69
|
+
|
|
70
|
+
`swarmauri_auth_idp_github` isolates this responsibility: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) exposes `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
71
|
+
|
|
72
|
+
### When to Use
|
|
73
|
+
|
|
74
|
+
Choose `swarmauri_auth_idp_github` when your integration needs gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
- PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
|
|
79
|
+
- Token exchange helpers that return normalized identity payloads for downstream services.
|
|
80
|
+
- Profile enrichment that fetches the authenticated user's primary verified email.
|
|
81
|
+
- Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
|
|
82
|
+
- ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
|
|
83
|
+
|
|
84
|
+
### Non-Goals
|
|
85
|
+
|
|
86
|
+
`swarmauri_auth_idp_github` owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Getting Started
|
|
91
|
+
|
|
92
|
+
### Prerequisites
|
|
93
|
+
|
|
94
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. Read the example’s inputs and service requirements before execution.
|
|
95
|
+
|
|
96
|
+
### Installation
|
|
97
|
+
|
|
98
|
+
**uv (project)**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
uv add swarmauri_auth_idp_github
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**uv (environment)**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv pip install swarmauri_auth_idp_github
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### uv
|
|
111
|
+
|
|
112
|
+
<!-- readme-standards:begin installation.uv -->
|
|
113
|
+
```bash
|
|
114
|
+
uv add swarmauri_auth_idp_github
|
|
115
|
+
```
|
|
116
|
+
<!-- readme-standards:end installation.uv -->
|
|
117
|
+
|
|
118
|
+
#### pip
|
|
119
|
+
|
|
120
|
+
<!-- readme-standards:begin installation.pip -->
|
|
121
|
+
```bash
|
|
122
|
+
python -m pip install swarmauri_auth_idp_github
|
|
123
|
+
```
|
|
124
|
+
<!-- readme-standards:end installation.pip -->
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install swarmauri_auth_idp_github
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Poetry
|
|
131
|
+
|
|
132
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
133
|
+
```bash
|
|
134
|
+
poetry add swarmauri_auth_idp_github
|
|
135
|
+
```
|
|
136
|
+
<!-- readme-standards:end installation.poetry -->
|
|
137
|
+
|
|
138
|
+
### Quick Start
|
|
139
|
+
|
|
140
|
+
#### Example
|
|
141
|
+
|
|
142
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
143
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/quick_start.py).
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import asyncio
|
|
147
|
+
from pydantic import SecretBytes, SecretStr
|
|
148
|
+
from swarmauri_auth_idp_github import GitHubOAuth21Login
|
|
149
|
+
|
|
150
|
+
login = GitHubOAuth21Login(
|
|
151
|
+
client_id="github-client-id",
|
|
152
|
+
client_secret=SecretStr("github-client-secret"),
|
|
153
|
+
redirect_uri="https://app.example.com/callback",
|
|
154
|
+
state_secret=SecretBytes(b"replace-with-random-bytes"),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
async def run_flow() -> None:
|
|
159
|
+
auth = await login.auth_url()
|
|
160
|
+
print(auth["url"])
|
|
161
|
+
# Send the browser to the authorization URL and capture code and state.
|
|
162
|
+
# In the callback, pass code and state to exchange_and_identity.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
asyncio.run(run_flow())
|
|
166
|
+
```
|
|
167
|
+
<!-- readme-standards:end example.quick-start -->
|
|
168
|
+
|
|
169
|
+
#### Expected Result
|
|
170
|
+
|
|
171
|
+
The example demonstrates the documented `swarmauri_auth_idp_github` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Usage
|
|
176
|
+
|
|
177
|
+
### Common Workflows
|
|
178
|
+
|
|
179
|
+
<!-- readme-standards:begin example.usage -->
|
|
180
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/usage.py).
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
import asyncio
|
|
184
|
+
from pydantic import SecretBytes, SecretStr
|
|
185
|
+
from swarmauri_auth_idp_github import GitHubOAuth21Login
|
|
186
|
+
|
|
187
|
+
login = GitHubOAuth21Login(
|
|
188
|
+
client_id="github-client-id",
|
|
189
|
+
client_secret=SecretStr("github-client-secret"),
|
|
190
|
+
redirect_uri="https://app.example.com/callback",
|
|
191
|
+
state_secret=SecretBytes(b"replace-with-random-bytes"),
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
async def run_flow() -> None:
|
|
196
|
+
auth = await login.auth_url()
|
|
197
|
+
print(auth["url"])
|
|
198
|
+
# Send the browser to the authorization URL and capture code and state.
|
|
199
|
+
# In the callback, pass code and state to exchange_and_identity.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
asyncio.run(run_flow())
|
|
203
|
+
```
|
|
204
|
+
<!-- readme-standards:end example.usage -->
|
|
205
|
+
|
|
206
|
+
1. Call `auth_url()` and redirect the browser to the returned URL.
|
|
207
|
+
2. Persist the `state` and verify it during the callback handler.
|
|
208
|
+
3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
|
|
209
|
+
4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
|
|
210
|
+
|
|
211
|
+
### Configuration
|
|
212
|
+
|
|
213
|
+
Configure `swarmauri_auth_idp_github` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
214
|
+
|
|
215
|
+
### Error Handling
|
|
216
|
+
|
|
217
|
+
The inspected `swarmauri_auth_idp_github` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
218
|
+
|
|
219
|
+
### Best Practices
|
|
220
|
+
|
|
221
|
+
Use the explicit `swarmauri_auth_idp_github` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`; an import or successful installation alone does not establish its runtime guarantees.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Package Boundary
|
|
226
|
+
|
|
227
|
+
### What It Owns
|
|
228
|
+
|
|
229
|
+
`swarmauri_auth_idp_github` is located in `standards` and owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Source-declared APIs include `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) records its direct dependency boundary.
|
|
230
|
+
|
|
231
|
+
### Public API and Import Surfaces
|
|
232
|
+
|
|
233
|
+
Import namespace: `swarmauri_auth_idp_github`.
|
|
234
|
+
|
|
235
|
+
Source-declared exports or types: `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`.
|
|
236
|
+
|
|
237
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
238
|
+
|
|
239
|
+
### Entry Points
|
|
240
|
+
|
|
241
|
+
<!-- readme-standards:begin entry-points -->
|
|
242
|
+
- `swarmauri.auth_idp` → `GitHubOAuth20AppClient` → `swarmauri_auth_idp_github:GitHubOAuth20AppClient`
|
|
243
|
+
- `swarmauri.auth_idp` → `GitHubOAuth20Login` → `swarmauri_auth_idp_github:GitHubOAuth20Login`
|
|
244
|
+
- `swarmauri.auth_idp` → `GitHubOAuth21AppClient` → `swarmauri_auth_idp_github:GitHubOAuth21AppClient`
|
|
245
|
+
- `swarmauri.auth_idp` → `GitHubOAuth21Login` → `swarmauri_auth_idp_github:GitHubOAuth21Login`
|
|
246
|
+
<!-- readme-standards:end entry-points -->
|
|
247
|
+
|
|
248
|
+
- `swarmauri.auth_idp:GitHubOAuth20Login`
|
|
249
|
+
- `swarmauri.auth_idp:GitHubOAuth21Login`
|
|
250
|
+
- `swarmauri.auth_idp:GitHubOAuth20AppClient`
|
|
251
|
+
- `swarmauri.auth_idp:GitHubOAuth21AppClient`
|
|
252
|
+
|
|
253
|
+
### Injected Dependencies
|
|
254
|
+
|
|
255
|
+
The direct installation dependencies of `swarmauri_auth_idp_github` are `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py).
|
|
256
|
+
|
|
257
|
+
### Protocol Consumers
|
|
258
|
+
|
|
259
|
+
No direct package-manifest dependency on `swarmauri_auth_idp_github` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
|
|
260
|
+
|
|
261
|
+
### Extensions
|
|
262
|
+
|
|
263
|
+
For `swarmauri_auth_idp_github`, use the source-declared public interfaces (`GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Operations and Readiness
|
|
268
|
+
|
|
269
|
+
### Operational Requirements
|
|
270
|
+
|
|
271
|
+
Operate `swarmauri_auth_idp_github` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
272
|
+
|
|
273
|
+
### Health and Observability
|
|
274
|
+
|
|
275
|
+
This README does not establish a standalone health endpoint for `swarmauri_auth_idp_github`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
276
|
+
|
|
277
|
+
### Security and Resource Limits
|
|
278
|
+
|
|
279
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py). The `swarmauri_auth_idp_github` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
280
|
+
|
|
281
|
+
### Compatibility
|
|
282
|
+
|
|
283
|
+
This source version of `swarmauri_auth_idp_github` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Verification
|
|
288
|
+
|
|
289
|
+
### Tests
|
|
290
|
+
|
|
291
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_auth_idp_github` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
292
|
+
|
|
293
|
+
- [tests/unit/test_github_oauth20_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_app_client_unit.py)
|
|
294
|
+
- [tests/unit/test_github_oauth20_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_login_unit.py)
|
|
295
|
+
- [tests/unit/test_github_oauth21_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_app_client_unit.py)
|
|
296
|
+
- [tests/unit/test_github_oauth21_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_login_unit.py)
|
|
297
|
+
|
|
298
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
299
|
+
|
|
300
|
+
The package tests run fully offline. From the repository's `pkgs/` directory:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
uv run --package swarmauri_auth_idp_github --directory standards/swarmauri_auth_idp_github pytest
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The tests replace the HTTP client with a recording fake that replays canned
|
|
307
|
+
GitHub responses, and they sign GitHub App JWTs with a throwaway RSA key
|
|
308
|
+
generated at test time. No GitHub account, OAuth app, credentials, environment
|
|
309
|
+
secrets, or network access are required.
|
|
310
|
+
|
|
311
|
+
These tests verify the requests the adapter builds (URLs, methods, headers,
|
|
312
|
+
form fields, and JSON bodies) and how it shapes the returned identities and
|
|
313
|
+
tokens. The email fallback test records existing behavior: the adapter can
|
|
314
|
+
return an unverified address when no primary verified email is available.
|
|
315
|
+
They do not verify interoperability with live GitHub. Confirming live
|
|
316
|
+
provider support requires a manual run against a real GitHub OAuth app or
|
|
317
|
+
GitHub App installation.
|
|
318
|
+
|
|
319
|
+
### Certification Status
|
|
320
|
+
|
|
321
|
+
No external certification is asserted for `swarmauri_auth_idp_github` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
322
|
+
|
|
323
|
+
### Evidence
|
|
324
|
+
|
|
325
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## FAQ
|
|
330
|
+
|
|
331
|
+
### Why
|
|
332
|
+
|
|
333
|
+
**Why select this package?** `swarmauri_auth_idp_github` provides gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
334
|
+
|
|
335
|
+
### How
|
|
336
|
+
|
|
337
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_auth_idp_github`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for the exact types and signatures involved.
|
|
338
|
+
|
|
339
|
+
### When
|
|
340
|
+
|
|
341
|
+
**When should I validate an upgrade?** Recheck `swarmauri_auth_idp_github` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Documentation and Related Packages
|
|
346
|
+
|
|
347
|
+
### More Documentation
|
|
348
|
+
|
|
349
|
+
The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) provide the supporting context for `swarmauri_auth_idp_github`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
350
|
+
|
|
351
|
+
### Related Packages
|
|
352
|
+
|
|
353
|
+
- [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
|
|
354
|
+
- [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
|
|
355
|
+
|
|
356
|
+
### Project Links
|
|
357
|
+
|
|
358
|
+
<!-- readme-standards:begin project-links -->
|
|
359
|
+
- [pypi: swarmauri_auth_idp_github](https://pypi.org/project/swarmauri_auth_idp_github/)
|
|
360
|
+
<!-- readme-standards:end project-links -->
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Contributing
|
|
365
|
+
|
|
366
|
+
### How to Contribute
|
|
367
|
+
|
|
368
|
+
To contribute to swarmauri-sdk, review the
|
|
369
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
370
|
+
which cover development workflow, testing, and coding standards.
|
|
371
|
+
|
|
372
|
+
### Development Setup
|
|
373
|
+
|
|
374
|
+
Work from the `pkgs/40-standards/swarmauri_auth_idp_github` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
375
|
+
|
|
376
|
+
### Notes for Maintainers
|
|
377
|
+
|
|
378
|
+
Edit authored prose directly in this `swarmauri_auth_idp_github` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Governance
|
|
383
|
+
|
|
384
|
+
### Ownership and Decision Making
|
|
385
|
+
|
|
386
|
+
Changes to `swarmauri_auth_idp_github` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
387
|
+
|
|
388
|
+
### Standards and Policies
|
|
389
|
+
|
|
390
|
+
`swarmauri_auth_idp_github` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
391
|
+
|
|
392
|
+
### Lifecycle and Migration
|
|
393
|
+
|
|
394
|
+
The `swarmauri_auth_idp_github` source version is `0.11.0`.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## License and Attribution
|
|
399
|
+
|
|
400
|
+
### License
|
|
401
|
+
|
|
402
|
+
<!-- readme-standards:begin license -->
|
|
403
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE).
|
|
404
|
+
<!-- readme-standards:end license -->
|
|
405
|
+
|
|
406
|
+
### Notices
|
|
407
|
+
|
|
408
|
+
<!-- readme-standards:begin notices -->
|
|
409
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE) for attribution.
|
|
410
|
+
<!-- readme-standards:end notices -->
|
|
411
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
swarmauri_auth_idp_github/GitHubAppClientMixin.py,sha256=v7xBrkBCz25x9XflEUtXL1sCfQWNS9_2BaZgSIumrrY,3736
|
|
2
|
+
swarmauri_auth_idp_github/GitHubOAuth20AppClient.py,sha256=bxOh9GKH0Iq1KYaiF5fZT0eAwF4nnvpCO9nGuiXfnOU,776
|
|
3
|
+
swarmauri_auth_idp_github/GitHubOAuth20Login.py,sha256=F45KfP2cAafZb_TrFFCxuuM_BwqedDS8Dh5qRyP8GF4,1179
|
|
4
|
+
swarmauri_auth_idp_github/GitHubOAuth21AppClient.py,sha256=Fw2ZJITz5E5xHifRqpiQLhPWCZFP7iDMFV6XmTsZSos,776
|
|
5
|
+
swarmauri_auth_idp_github/GitHubOAuth21Login.py,sha256=Kwml6ZWLJbYINNcNPZmtGASCZeEB7Il1uKOksq4uQ6Y,1179
|
|
6
|
+
swarmauri_auth_idp_github/GitHubOAuthLoginMixin.py,sha256=gFrtt_MS78J2oFJBom2RqrsglDKPLPGIpw7vK2YZiRk,5758
|
|
7
|
+
swarmauri_auth_idp_github/__init__.py,sha256=kWBQypWyfGZQXClW-rDgW2mhzpu_x_1KQ2dG0DGAe18,410
|
|
8
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/METADATA,sha256=sLBcs_N_w4Y8XxuJFjIBJM7c8EKemSQOMTU0tdZ6PoI,23885
|
|
9
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
10
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/entry_points.txt,sha256=Kyl5ULzQvFKfdh81CReMHOtLVSSsE63J0mgj7ggZRuk,294
|
|
11
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
|
|
12
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/licenses/NOTICE,sha256=IsfbwWDAm__Zr64WSLf5LnxvIWOaMbd2KLHAePq1oFE,198
|
|
13
|
+
swarmauri_auth_idp_github-0.11.0.dist-info/RECORD,,
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: swarmauri_auth_idp_github
|
|
3
|
-
Version: 0.2.0.dev5
|
|
4
|
-
Summary: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri
|
|
5
|
-
License-Expression: Apache-2.0
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: swarmauri,sdk,experimental,identity,oauth2,oauth21,github,idp
|
|
8
|
-
Author: Jacob Stewart
|
|
9
|
-
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.13
|
|
11
|
-
Classifier: Development Status :: 1 - Planning
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
-
Classifier: Natural Language :: English
|
|
15
|
-
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier: Topic :: Internet :: WWW/HTTP
|
|
22
|
-
Classifier: Topic :: Security :: Cryptography
|
|
23
|
-
Requires-Dist: httpx (>=0.27)
|
|
24
|
-
Requires-Dist: pyjwt[crypto] (>=2.8)
|
|
25
|
-
Requires-Dist: swarmauri_base
|
|
26
|
-
Requires-Dist: swarmauri_core
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
<p align="center">
|
|
32
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_github/">
|
|
33
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github" alt="PyPI - Downloads"/></a>
|
|
34
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github/">
|
|
35
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github.svg"/></a>
|
|
36
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_github/">
|
|
37
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_github" alt="PyPI - Python Version"/></a>
|
|
38
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_github/">
|
|
39
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_github" alt="PyPI - License"/></a>
|
|
40
|
-
<a href="https://pypi.org/project/swarmauri_auth_idp_github/">
|
|
41
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?label=swarmauri_auth_idp_github&color=green" alt="PyPI - swarmauri_auth_idp_github"/></a>
|
|
42
|
-
</p>
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
# Swarmauri Auth IDP GitHub
|
|
47
|
-
|
|
48
|
-
GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
|
|
49
|
-
|
|
50
|
-
## Features
|
|
51
|
-
|
|
52
|
-
- PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
|
|
53
|
-
- Token exchange helpers that return normalized identity payloads for downstream services.
|
|
54
|
-
- Profile enrichment that fetches the authenticated user's primary verified email.
|
|
55
|
-
- Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
|
|
56
|
-
- ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
|
|
57
|
-
|
|
58
|
-
## Installation
|
|
59
|
-
|
|
60
|
-
### pip
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pip install swarmauri_auth_idp_github
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### uv (project)
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
uv add swarmauri_auth_idp_github
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### uv (environment)
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
uv pip install swarmauri_auth_idp_github
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Usage
|
|
79
|
-
|
|
80
|
-
```python
|
|
81
|
-
import asyncio
|
|
82
|
-
from pydantic import SecretBytes, SecretStr
|
|
83
|
-
from swarmauri_auth_idp_github import GitHubOAuth21Login
|
|
84
|
-
|
|
85
|
-
login = GitHubOAuth21Login(
|
|
86
|
-
client_id="github-client-id",
|
|
87
|
-
client_secret=SecretStr("github-client-secret"),
|
|
88
|
-
redirect_uri="https://app.example.com/callback",
|
|
89
|
-
state_secret=SecretBytes(b"replace-with-random-bytes"),
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
async def run_flow() -> None:
|
|
93
|
-
auth = await login.auth_url()
|
|
94
|
-
print(auth["url"])
|
|
95
|
-
# Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
|
|
96
|
-
# Later, call `login.exchange_and_identity(code, state)` inside your callback handler.
|
|
97
|
-
|
|
98
|
-
asyncio.run(run_flow())
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Workflow Summary
|
|
102
|
-
|
|
103
|
-
1. Call `auth_url()` and redirect the browser to the returned URL.
|
|
104
|
-
2. Persist the `state` and verify it during the callback handler.
|
|
105
|
-
3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
|
|
106
|
-
4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
|
|
107
|
-
|
|
108
|
-
## Entry Points
|
|
109
|
-
|
|
110
|
-
- `swarmauri.auth_idp:GitHubOAuth20Login`
|
|
111
|
-
- `swarmauri.auth_idp:GitHubOAuth21Login`
|
|
112
|
-
- `swarmauri.auth_idp:GitHubOAuth20AppClient`
|
|
113
|
-
- `swarmauri.auth_idp:GitHubOAuth21AppClient`
|
|
114
|
-
|
|
115
|
-
## Contributing
|
|
116
|
-
|
|
117
|
-
To contribute to swarmauri-sdk, review the
|
|
118
|
-
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
119
|
-
which cover development workflow, testing, and coding standards.
|
|
120
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
swarmauri_auth_idp_github/GitHubAppClientMixin.py,sha256=weKQX7z2wdULEkJdRvqpD25_W2E0qX-pGUfSslUonkY,3718
|
|
2
|
-
swarmauri_auth_idp_github/GitHubOAuth20AppClient.py,sha256=bxOh9GKH0Iq1KYaiF5fZT0eAwF4nnvpCO9nGuiXfnOU,776
|
|
3
|
-
swarmauri_auth_idp_github/GitHubOAuth20Login.py,sha256=O_WhYJE3RM0_5NWl0Fgasfcr23qULW6r6PD3J6taciw,1165
|
|
4
|
-
swarmauri_auth_idp_github/GitHubOAuth21AppClient.py,sha256=Fw2ZJITz5E5xHifRqpiQLhPWCZFP7iDMFV6XmTsZSos,776
|
|
5
|
-
swarmauri_auth_idp_github/GitHubOAuth21Login.py,sha256=Qt2KIDsbhDZC_Pv5Ggu344n8D-KRWJQGhADisbQtJ9Q,1165
|
|
6
|
-
swarmauri_auth_idp_github/GitHubOAuthLoginMixin.py,sha256=IglqswmCEXX9hEvS0b2dnW5_k2nQT2bXrWbZu20Sypo,4615
|
|
7
|
-
swarmauri_auth_idp_github/__init__.py,sha256=kWBQypWyfGZQXClW-rDgW2mhzpu_x_1KQ2dG0DGAe18,410
|
|
8
|
-
swarmauri_auth_idp_github-0.2.0.dev5.dist-info/METADATA,sha256=D4FUHCgura2odzk8q9AAhYgs71xijtTvmKnLY-TFNvg,4542
|
|
9
|
-
swarmauri_auth_idp_github-0.2.0.dev5.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
10
|
-
swarmauri_auth_idp_github-0.2.0.dev5.dist-info/entry_points.txt,sha256=Kyl5ULzQvFKfdh81CReMHOtLVSSsE63J0mgj7ggZRuk,294
|
|
11
|
-
swarmauri_auth_idp_github-0.2.0.dev5.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
|
|
12
|
-
swarmauri_auth_idp_github-0.2.0.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|