toolframe-oidc-auth 0.2.0__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.
@@ -0,0 +1,39 @@
1
+ name: Validate Python distribution
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+ workflow_call:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ validate:
14
+ runs-on: ${{ matrix.os }}
15
+ timeout-minutes: 25
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-24.04, macos-15]
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ persist-credentials: false
24
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
25
+ with:
26
+ python-version: '3.14.7'
27
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
28
+ with:
29
+ version: '0.12.8'
30
+ enable-cache: false
31
+ - name: Test and install wheel and source distribution
32
+ run: python scripts/validate_release.py --output dist/validated
33
+ - name: Retain only validated distributions
34
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
35
+ with:
36
+ name: python-dist-${{ matrix.os }}
37
+ path: dist/validated/*
38
+ if-no-files-found: error
39
+ retention-days: 14
@@ -0,0 +1,65 @@
1
+ name: Publish Python distribution
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ index:
7
+ description: Package index; run against the matching vVERSION tag
8
+ type: choice
9
+ options: [testpypi, pypi]
10
+ default: testpypi
11
+ required: true
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: publish-${{ inputs.index }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ release-tag:
22
+ runs-on: ubuntu-24.04
23
+ timeout-minutes: 5
24
+ steps:
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ persist-credentials: false
28
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
29
+ with:
30
+ python-version: '3.14.7'
31
+ - name: Require the exact package version tag
32
+ env:
33
+ RELEASE_REF: ${{ github.ref }}
34
+ run: |
35
+ python - <<'PYCODE'
36
+ import os, pathlib, tomllib
37
+ project = tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']
38
+ expected = 'refs/tags/v' + project['version']
39
+ if os.environ['RELEASE_REF'] != expected:
40
+ raise SystemExit('Publication requires ' + expected)
41
+ PYCODE
42
+
43
+ validate:
44
+ needs: release-tag
45
+ uses: ./.github/workflows/ci.yml
46
+ secrets: inherit
47
+
48
+ publish:
49
+ needs: [release-tag, validate]
50
+ runs-on: ubuntu-24.04
51
+ timeout-minutes: 10
52
+ environment:
53
+ name: ${{ inputs.index }}
54
+ permissions:
55
+ contents: read
56
+ id-token: write
57
+ steps:
58
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
59
+ with:
60
+ name: python-dist-ubuntu-24.04
61
+ path: dist/
62
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
63
+ with:
64
+ packages-dir: dist/
65
+ repository-url: ${{ inputs.index == 'testpypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
@@ -0,0 +1,15 @@
1
+ /.venv/
2
+ /dist/
3
+ /build/
4
+ /.pytest_cache/
5
+ /.ruff_cache/
6
+ __pycache__/
7
+ *.py[cod]
8
+ /examples/tinyauth/.env
9
+ /examples/tinyauth/secrets/
10
+ /examples/tinyauth/certs/
11
+
12
+ # Local working documents, issue state, and development worktrees.
13
+ /.local/
14
+ /.issues/
15
+ /.worktrees/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ toolframe-oidc-auth
2
+ Copyright 2026 byfb
@@ -0,0 +1,235 @@
1
+ Metadata-Version: 2.5
2
+ Name: toolframe-oidc-auth
3
+ Version: 0.2.0
4
+ Summary: Shared OIDC sign-in and OAuth delegation for Toolframe
5
+ Project-URL: Homepage, https://github.com/toolframe/toolframe-oidc-auth
6
+ Project-URL: Repository, https://github.com/toolframe/toolframe-oidc-auth
7
+ Project-URL: Documentation, https://github.com/toolframe/toolframe-oidc-auth#readme
8
+ Project-URL: Issues, https://github.com/toolframe/toolframe-oidc-auth/issues
9
+ Author-email: byfb <62798989+byfb@users.noreply.github.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Requires-Python: >=3.14
14
+ Requires-Dist: authlib==1.8.0
15
+ Requires-Dist: cryptography==50.0.2
16
+ Requires-Dist: httpx2<3,>=2.8
17
+ Requires-Dist: starlette<2,>=1
18
+ Requires-Dist: toolframe-sdk==0.3.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # Toolframe OIDC Auth
22
+
23
+ Use one OIDC identity for Dashboard sign-in and separate, revocable OAuth grants
24
+ for third-party agents. Authlib implements the upstream OIDC client and downstream
25
+ OAuth authorization server. Toolframe Auth owns local users, browser sessions and
26
+ permission grants; MCP Auth consumes the shared token-verification service.
27
+
28
+ This plugin requires SDK 0.3.0, Core 0.6.1, Auth 0.2.0, Dashboard Auth 0.1.3 and
29
+ MCP Auth 0.2.0.
30
+ The OIDC plugin is optional and is not enabled by the Entry Register template.
31
+
32
+ ## Quick start
33
+
34
+ 1. Add the package to a running application, leaving it disabled until configured:
35
+ `toolframe --home APP plugin add pypi:toolframe-oidc-auth==0.2.0`.
36
+ 2. Install compatible Core, Auth and Dashboard packages. For an existing Auth v1
37
+ store, back it up with its retained secrets, stage the new Auth wheel with
38
+ `toolframe --home APP plugin update auth --source pypi:toolframe-auth==0.2.0`, inspect
39
+ `toolframe --home APP migrate plan auth`, then apply that returned plan using
40
+ `toolframe --home APP migrate apply auth --plan-id PLAN_ID`. Migration v2 only
41
+ adds user, external-identity, session and agent-grant tables.
42
+ 3. Register a confidential web client at the upstream identity provider, with
43
+ the exact callback `https://app.example/_toolframe/oidc/callback/google`.
44
+ Store its client secret in a regular file readable only by the application
45
+ owner (`chmod 600`); use an absolute path in configuration.
46
+ 4. Add the following desired-state settings to `APP/toolframe.toml`, preserving
47
+ the application's existing ID, plugin declarations and storage configuration.
48
+ Replace example values, then run `toolframe --home APP apply`.
49
+
50
+ ```toml
51
+ [application]
52
+ # Keep the existing application ID and other settings.
53
+ public_url = "https://app.example"
54
+
55
+ [access]
56
+ mode = "protected"
57
+ failure_mode = "closed"
58
+ auth_provider = "auth"
59
+ dashboard_auth = "dashboard-auth"
60
+ oidc_provider = "oidc-auth"
61
+
62
+ [mcp_access]
63
+ mode = "protected"
64
+ auth_provider = "mcp-auth"
65
+
66
+ [plugins.auth.config]
67
+ identity_provider = "oidc-auth"
68
+ federated_identities = [
69
+ { issuer = "https://accounts.google.com", subject = "VERIFIED_GOOGLE_SUB", label = "Alice", scopes = ["entry-register.read"] },
70
+ ]
71
+
72
+ [plugins.oidc-auth]
73
+ source = "pypi:toolframe-oidc-auth==0.2.0"
74
+ enabled = true
75
+
76
+ [plugins.oidc-auth.config]
77
+ public_url = "https://app.example"
78
+ scopes = ["entry-register.read"]
79
+ dynamic_registration = true
80
+ max_clients = 1000
81
+ access_token_seconds = 300
82
+ grant_seconds = 2592000
83
+
84
+ [plugins.oidc-auth.config.providers.google]
85
+ label = "Google"
86
+ issuer = "https://accounts.google.com"
87
+ server_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"
88
+ client_id = "GOOGLE_CLIENT_ID"
89
+ client_secret_file = "/absolute/private/google-client-secret"
90
+ ```
91
+
92
+ The `auth`, `dashboard-auth`, `mcp-auth` and SQLite provider must be enabled in the
93
+ existing composition. Set Core's `application.public_url` and this plugin's
94
+ `public_url` identically. Terminate HTTPS at a reverse proxy and preserve the
95
+ canonical Host. Core never derives its issuer from forwarded headers. Only
96
+ explicit OAuth routes allow cross-origin entry; Dashboard management and consent
97
+ submission remain same-origin. Public-host requests cannot inherit proxy-loopback
98
+ operator privileges. Configure proxy request limits for publicly exposed login
99
+ and dynamic-registration endpoints.
100
+
101
+ The login page offers **Continue with Google** alongside Access Password login.
102
+ Admission uses an administrator-verified **issuer + subject**, never an email
103
+ address. The allowlist creates a local user on first successful login. Later
104
+ changes belong to **User access** or the protected user-management API; changing
105
+ that initial-admission entry does not overwrite an existing user. Unlisted
106
+ identities are rejected. A user needs the relevant business scopes before they
107
+ can delegate them to an agent. `system.auth.users` grants scoped user management;
108
+ each federated user receives `system.auth.self` for their own connections.
109
+
110
+ ## Google, Keycloak and TinyAuth
111
+
112
+ Upstream providers share the same Authlib adapter; they do not need separate
113
+ Toolframe authentication implementations. Use Keycloak as an identity broker by
114
+ setting its realm issuer and discovery URL and registering the same Toolframe
115
+ callback under a chosen provider ID, for example `keycloak`. Google can then be
116
+ configured as an upstream provider within Keycloak. Toolframe still owns local
117
+ permissions and issues the app-specific access token.
118
+
119
+ Each provider accepts `issuer`, `server_metadata_url`, `client_id`,
120
+ `client_secret_file`, optional `label`, optional `ca_file`, and
121
+ `token_endpoint_auth_method` (`client_secret_basic`, the default, or
122
+ `client_secret_post`). HTTPS certificate validation stays enabled. `ca_file` adds
123
+ a private CA for a controlled deployment; client secrets and IdP tokens are never
124
+ included in browser presentation or the configuration journal. A changed secret
125
+ file requires plugin reload. Provider metadata is discovered lazily, so an IdP
126
+ outage does not prevent plugin startup or invalidate existing local sessions.
127
+
128
+ See the [TinyAuth Docker fixture](examples/tinyauth/README.md) for reproducible,
129
+ local TLS, user and client provisioning. Real acceptance covers TinyAuth; Google
130
+ and Keycloak use the documented generic path but need deployment-specific live
131
+ verification. [Google OIDC documentation](https://developers.google.com/identity/openid-connect/openid-connect),
132
+ [Keycloak identity brokering](https://www.keycloak.org/docs/latest/server_admin/index.html#_identity_broker),
133
+ [Authlib Starlette OIDC client](https://docs.authlib.org/en/latest/client/starlette.html)
134
+ and [Authlib authorization server](https://docs.authlib.org/en/latest/oauth2/server.html)
135
+ describe the upstream protocols and library integration.
136
+
137
+ ## Connect an agent
138
+
139
+ Give an OAuth-capable MCP client `https://app.example/mcp`. A protected request
140
+ returns a Bearer challenge pointing at protected-resource metadata. The client
141
+ can discover the authorization server, register, request consent and exchange an
142
+ authorization code using PKCE S256. Consent displays the client ID, name, redirect
143
+ URI, target resource and requested scopes; display names are unverified client
144
+ metadata. If necessary, the user signs in at the upstream provider. Dashboard
145
+ and Agent flows resolve to the same local user, with independent credentials.
146
+
147
+ OAuth endpoints are `/oauth/authorize`, `/oauth/token`, `/oauth/register` (when
148
+ enabled) and `/oauth/revoke`. Authorization-server metadata is
149
+ `/.well-known/oauth-authorization-server/oauth`; resource metadata is
150
+ `/.well-known/oauth-protected-resource/mcp`. Both authorization and token requests
151
+ must include `resource=https://app.example/mcp`. This is the default allowed
152
+ resource; `resources` can declare additional exact URLs for custom consumers of
153
+ the generic verifier. Core currently integrates that verifier with MCP only.
154
+
155
+ This release supports public clients, authorization-code + S256, refresh-token
156
+ rotation, static registration and bounded RFC 7591 dynamic registration. An
157
+ omitted registration authentication method selects `none`, explicitly returned
158
+ in the registration response. Explicit secret-based client authentication is
159
+ rejected. No wildcard redirects are accepted: redirects must exactly match an
160
+ HTTPS URL or an HTTP loopback URL. To disable DCR, use:
161
+
162
+ ```toml
163
+ [plugins.oidc-auth.config]
164
+ # Include the other required settings from above.
165
+ dynamic_registration = false
166
+ clients = [
167
+ { client_id = "desktop-agent", client_name = "Desktop agent", redirect_uris = ["http://127.0.0.1:8347/callback"] },
168
+ ]
169
+ ```
170
+
171
+ Advertise only the business scopes you intend to expose through this issuer.
172
+ Some MCP clients request every scope in resource metadata. Consent always shows
173
+ the actual requested set. System permissions cannot be delegated. Client ID
174
+ Metadata Documents (CIMD), confidential downstream clients, device grants,
175
+ client-credentials grants, SAML, downstream OIDC ID tokens and automatic
176
+ account linking are outside this release. An upstream ID/access token is never
177
+ accepted as an app bearer token. Existing `tf_mcp_` keys remain usable alongside
178
+ OAuth; an unavailable optional OAuth plugin does not disable key verification.
179
+
180
+ ## Credentials, revocation and backup
181
+
182
+ OAuth access tokens last 300 seconds by default (30–900 configurable); grants
183
+ last 30 days by default (60 seconds–one year configurable). Tokens use 256 random
184
+ bits and only digests are persisted. Codes expire after 60 seconds and are single
185
+ use. Refresh tokens rotate, cannot outlive the grant, and replay revokes the
186
+ whole grant. Every MCP admission checks token expiry, resource binding, current
187
+ user permissions and grant status. Already admitted operations may finish.
188
+
189
+ **Connected agents** lets the user revoke a connection without signing out of
190
+ Dashboard. Disabling the user invalidates sessions and revokes all their grants.
191
+ Logout ends the local browser session; it does not globally log out the IdP or
192
+ revoke agent grants. Permission reductions take effect on subsequent admissions.
193
+ OAuth authorization is explicit on each new flow; there is no implicit consent
194
+ based solely on an upstream login.
195
+
196
+ The plugin persists encrypted, browser-bound ten-minute authorization flows and
197
+ code/token digests in its managed store. Pending flows are capped at 1000 and
198
+ expired flows are removed when new flows are created. Client registrations are
199
+ persistent and bounded by `max_clients`; they are not automatically deleted.
200
+ Token and grant history currently requires operator-managed retention. Back up
201
+ `data/plugins/auth/data.sqlite`, `data/plugins/oidc-auth/data.sqlite`, retained
202
+ `.toolframe/secrets/`, composition, and referenced upstream secret files together,
203
+ using consistent SQLite backups. Keep the `oidc-auth/flow-key.key` secret across
204
+ reloads/restarts. A missing key with an existing store blocks activation; restore it from backup.
205
+
206
+ ## Development checks
207
+
208
+ With matching SDK, Auth and SQLite packages installed in a Python 3.14 venv:
209
+
210
+ ```sh
211
+ uv pip install --python .venv/bin/python --find-links ../wheelhouse -e .
212
+ uv pip install --python .venv/bin/python pytest pytest-asyncio ruff
213
+ .venv/bin/pytest -q
214
+ .venv/bin/ruff check src tests examples
215
+ ```
216
+
217
+ Tests use real managed SQLite and Authlib grants. They cover PKCE rejection,
218
+ resource binding, one-use codes, refresh rotation/replay, browser-bound consent,
219
+ explicit denial, client registration and revocation. Core's coordinated suite
220
+ covers real workers, discovery, proxy authority and optional-provider outages;
221
+ the fixture script exercises an installed app through real FastMCP OAuth.
222
+
223
+ For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
224
+
225
+ ## License
226
+
227
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
228
+
229
+ ## PostgreSQL storage
230
+
231
+ Version 0.2 requires SDK 0.3 and declares PostgreSQL migration SQL alongside the
232
+ unchanged SQLite history. Provision this plugin’s stable store owner with the
233
+ PostgreSQL provider before enabling it. The application still runs one Core;
234
+ retain its private keys and configuration with the application home. Existing
235
+ SQLite records are not imported automatically.