toolframe-dashboard-auth 0.1.3__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.
Files changed (25) hide show
  1. toolframe_dashboard_auth-0.1.3/.github/workflows/ci.yml +18 -0
  2. toolframe_dashboard_auth-0.1.3/.github/workflows/publish.yml +64 -0
  3. toolframe_dashboard_auth-0.1.3/.github/workflows/validate.yml +62 -0
  4. toolframe_dashboard_auth-0.1.3/.gitignore +13 -0
  5. toolframe_dashboard_auth-0.1.3/LICENSE +202 -0
  6. toolframe_dashboard_auth-0.1.3/NOTICE +2 -0
  7. toolframe_dashboard_auth-0.1.3/PKG-INFO +106 -0
  8. toolframe_dashboard_auth-0.1.3/README.md +88 -0
  9. toolframe_dashboard_auth-0.1.3/docs/ci.md +103 -0
  10. toolframe_dashboard_auth-0.1.3/docs/releasing.md +59 -0
  11. toolframe_dashboard_auth-0.1.3/pyproject.toml +39 -0
  12. toolframe_dashboard_auth-0.1.3/scripts/check_release_tag.py +14 -0
  13. toolframe_dashboard_auth-0.1.3/scripts/ci.sh +68 -0
  14. toolframe_dashboard_auth-0.1.3/scripts/wheel_smoke.py +70 -0
  15. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/__init__.py +1 -0
  16. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/connections.py +40 -0
  17. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/login.html +24 -0
  18. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/mcp_page.py +146 -0
  19. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/page.py +338 -0
  20. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/plugin.py +69 -0
  21. toolframe_dashboard_auth-0.1.3/src/toolframe_dashboard_auth/users.py +52 -0
  22. toolframe_dashboard_auth-0.1.3/tests/test_identities.py +80 -0
  23. toolframe_dashboard_auth-0.1.3/tests/test_mcp_page.py +111 -0
  24. toolframe_dashboard_auth-0.1.3/tests/test_presentation.py +411 -0
  25. toolframe_dashboard_auth-0.1.3/uv.lock +1016 -0
@@ -0,0 +1,18 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ci-${{ github.event.pull_request.number || github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ validate:
17
+ uses: ./.github/workflows/validate.yml
18
+ secrets: inherit
@@ -0,0 +1,64 @@
1
+ name: Publish package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ environment:
7
+ description: Package index (run this workflow on a matching version tag)
8
+ type: choice
9
+ required: true
10
+ default: testpypi
11
+ options:
12
+ - testpypi
13
+ - pypi
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ concurrency:
19
+ group: publish-${{ github.ref }}
20
+ cancel-in-progress: false
21
+
22
+ jobs:
23
+ check-tag:
24
+ runs-on: ubuntu-24.04
25
+ timeout-minutes: 5
26
+ steps:
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ persist-credentials: false
30
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
31
+ with:
32
+ python-version: '3.14.7'
33
+ - name: Require a tag matching project.version
34
+ run: python scripts/check_release_tag.py
35
+
36
+ validate:
37
+ needs: check-tag
38
+ uses: ./.github/workflows/validate.yml
39
+ secrets: inherit
40
+ publish:
41
+ needs: validate
42
+ runs-on: ubuntu-24.04
43
+ timeout-minutes: 10
44
+ environment:
45
+ name: ${{ inputs.environment }}
46
+ permissions:
47
+ contents: read
48
+ id-token: write
49
+ steps:
50
+ - name: Download distributions validated in this run
51
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
52
+ with:
53
+ name: dashboard-auth-dist-${{ github.sha }}
54
+ path: dist
55
+
56
+ - name: Publish to TestPyPI
57
+ if: inputs.environment == 'testpypi'
58
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
59
+ with:
60
+ repository-url: https://test.pypi.org/legacy/
61
+
62
+ - name: Publish to PyPI
63
+ if: inputs.environment == 'pypi'
64
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
@@ -0,0 +1,62 @@
1
+ name: Validate package
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ # Concurrency belongs to the caller, so validation cannot cancel a publish run.
10
+ jobs:
11
+ validate:
12
+ name: Python 3.14.7 / ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ timeout-minutes: 20
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [ubuntu-24.04, macos-15]
19
+ steps:
20
+ - name: Check out this revision
21
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ path: toolframe-dashboard-auth
24
+ persist-credentials: false
25
+
26
+ - name: Check out the pinned SDK
27
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ # repository_owner is the base repository owner for fork PRs.
30
+ repository: ${{ vars.TOOLFRAME_REPOSITORY_OWNER || github.repository_owner }}/toolframe-sdk
31
+ token: ${{ secrets.TOOLFRAME_READ_TOKEN || github.token }}
32
+ ref: ef91b609137a5fe7bae8e0c893e74b096ff06ffe
33
+ path: toolframe-sdk
34
+ persist-credentials: false
35
+
36
+ - name: Set up Python
37
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
38
+ with:
39
+ python-version: '3.14.7'
40
+
41
+ - name: Set up uv
42
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
43
+ with:
44
+ version: '0.12.8'
45
+ enable-cache: false
46
+
47
+ - name: Validate from fresh environments
48
+ id: validate
49
+ working-directory: toolframe-dashboard-auth
50
+ shell: bash
51
+ run: bash scripts/ci.sh
52
+
53
+ - name: Retain validated distributions
54
+ if: matrix.os == 'ubuntu-24.04'
55
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
56
+ with:
57
+ name: dashboard-auth-dist-${{ github.sha }}
58
+ path: |
59
+ ${{ steps.validate.outputs.dist-dir }}/*.whl
60
+ ${{ steps.validate.outputs.dist-dir }}/*.tar.gz
61
+ if-no-files-found: error
62
+ retention-days: 7
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ dist/
6
+ /build/
7
+ /.coverage
8
+ /htmlcov/
9
+
10
+ # Local working documents, issue state, and development worktrees.
11
+ /.local/
12
+ /.issues/
13
+ /.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-dashboard-auth
2
+ Copyright 2026 byfb
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.5
2
+ Name: toolframe-dashboard-auth
3
+ Version: 0.1.3
4
+ Summary: Password login and access management pages for Toolframe
5
+ Project-URL: Homepage, https://github.com/toolframe/toolframe-dashboard-auth
6
+ Project-URL: Repository, https://github.com/toolframe/toolframe-dashboard-auth
7
+ Project-URL: Documentation, https://github.com/toolframe/toolframe-dashboard-auth#readme
8
+ Project-URL: Issues, https://github.com/toolframe/toolframe-dashboard-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: toolframe-sdk<0.4,>=0.2
15
+ Provides-Extra: ui
16
+ Requires-Dist: streamlit==1.61.0; extra == 'ui'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Toolframe Dashboard Auth
20
+
21
+ The `dashboard-auth` provider supplies password and configured OIDC login choices,
22
+ plus Streamlit access-management pages. It depends on the `toolframe.auth` service
23
+ and SDK 0.2–0.3. Core handles cookies, admission and protected auth API calls; this
24
+ plugin holds no credential database or verifier key.
25
+
26
+ Install the package in a running application with compatible Auth and Dashboard
27
+ providers, then open **Access passwords** as a local operator:
28
+
29
+ ```sh
30
+ toolframe --home APP plugin add pypi:toolframe-dashboard-auth==0.1.3 --enable
31
+ ```
32
+
33
+ With Core 0.6.1, **Access by entrance** reports Dashboard/service access, independent
34
+ MCP policy, declared public HTTP methods and the current local/operator context.
35
+ The policy form lets settings administrators choose closed or public behavior
36
+ when Dashboard authentication fails. Closed is the default for new applications;
37
+ existing application choices are preserved. Older Core versions keep the existing
38
+ policy controls but do not offer the unsupported failure-policy editor. Public
39
+ HTTP declarations and llms documents remain public, and method scopes do not
40
+ provide per-person row isolation.
41
+ While this page is available, credential-list errors leave its policy controls
42
+ usable by local operators. If Dashboard Auth itself is unavailable, use Core's
43
+ local management API for recovery.
44
+
45
+ With compatible Core/Auth and `toolframe-oidc-auth` installed, the login page
46
+ loads provider buttons from Core's safe provider catalogue. **Connected agents**
47
+ requires `system.auth.self` and lets a federated user revoke their own connections
48
+ without logging out. **User access** requires `system.auth.users` and manages
49
+ permissions/disablement for identities already admitted by application
50
+ configuration. Disabling a user revokes their browser sessions and agent grants.
51
+ The pages call Core's protected facade; no upstream credentials enter Streamlit.
52
+
53
+ The optional **MCP keys** page requires `system.auth.mcp_keys` and manages named
54
+ 256-bit bearer keys through core's separate MCP auth API. Install/enable
55
+ `toolframe-mcp-auth` to generate keys, select business scopes and expiry, copy each
56
+ secret once and revoke it later. `system.settings.manage` also permits changing
57
+ the independent MCP public/protected policy. The page remains available for policy
58
+ recovery when the MCP auth provider is absent. See the MCP authentication guide
59
+ in the core repository for configuration details.
60
+
61
+ The management page fills in an editable **Unnamed password** label, adding a
62
+ number for names already in use. The password field accepts 8–32 characters and
63
+ shows a stable random suggestion as its placeholder. Leave the field blank to use
64
+ that exact suggestion; after creation, copy the one-time displayed password.
65
+ Failed submissions preserve the draft; successful creation starts a fresh one.
66
+
67
+ **Set expiry** immediately reveals a duration and unit side by side, with minutes,
68
+ hours, days, weeks or calendar months and a calculated local expiry preview.
69
+ Preview and record timestamps use the browser's timezone (its UTC offset is a
70
+ fallback, then UTC if neither is available). Durations start when saved; months
71
+ follow that local calendar and clamp to the destination month's last day. Other
72
+ units measure elapsed time, including across daylight-saving changes. No
73
+ date/time entry is needed.
74
+ Turning expiry off hides the controls and saves no expiry. When editing, leave the
75
+ duration blank to preserve the exact existing expiry, or enter a duration to
76
+ replace it. Saving other grant fields never silently extends the expiry.
77
+
78
+ The page selects scopes, edits grants, revokes records and shows creation,
79
+ last-login and last-use timestamps. Its page
80
+ requires `system.auth.passwords`; access-policy controls additionally require
81
+ `system.settings.manage`. Core/auth enforce the same rules beyond the UI.
82
+
83
+ Core serves the login page at `/_toolframe/auth/login`. The existing Dashboard
84
+ provider owns the common local/public/protected header so it remains available
85
+ when this integration fails or is disabled. Streamlit is supplied by the shared
86
+ Dashboard execution environment, not the business/auth worker.
87
+
88
+ ```sh
89
+ uv sync
90
+ uv run pytest -q
91
+ uv run ruff check src tests
92
+ uv build --wheel
93
+ ```
94
+
95
+ For the same isolated validation used by GitHub Actions, run `bash scripts/ci.sh`
96
+ with Python 3.14.7, uv 0.12.8 and a sibling `toolframe-sdk` Git checkout available.
97
+ This runs the presentation tests against a newly built wheel, checks both
98
+ distributions, and verifies a separate installation with only runtime dependencies.
99
+ See [CI and publishing](docs/ci.md) for the pinned SDK revision, workflow triggers,
100
+ release prerequisites and local validation limits.
101
+
102
+ For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
103
+
104
+ ## License
105
+
106
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,88 @@
1
+ # Toolframe Dashboard Auth
2
+
3
+ The `dashboard-auth` provider supplies password and configured OIDC login choices,
4
+ plus Streamlit access-management pages. It depends on the `toolframe.auth` service
5
+ and SDK 0.2–0.3. Core handles cookies, admission and protected auth API calls; this
6
+ plugin holds no credential database or verifier key.
7
+
8
+ Install the package in a running application with compatible Auth and Dashboard
9
+ providers, then open **Access passwords** as a local operator:
10
+
11
+ ```sh
12
+ toolframe --home APP plugin add pypi:toolframe-dashboard-auth==0.1.3 --enable
13
+ ```
14
+
15
+ With Core 0.6.1, **Access by entrance** reports Dashboard/service access, independent
16
+ MCP policy, declared public HTTP methods and the current local/operator context.
17
+ The policy form lets settings administrators choose closed or public behavior
18
+ when Dashboard authentication fails. Closed is the default for new applications;
19
+ existing application choices are preserved. Older Core versions keep the existing
20
+ policy controls but do not offer the unsupported failure-policy editor. Public
21
+ HTTP declarations and llms documents remain public, and method scopes do not
22
+ provide per-person row isolation.
23
+ While this page is available, credential-list errors leave its policy controls
24
+ usable by local operators. If Dashboard Auth itself is unavailable, use Core's
25
+ local management API for recovery.
26
+
27
+ With compatible Core/Auth and `toolframe-oidc-auth` installed, the login page
28
+ loads provider buttons from Core's safe provider catalogue. **Connected agents**
29
+ requires `system.auth.self` and lets a federated user revoke their own connections
30
+ without logging out. **User access** requires `system.auth.users` and manages
31
+ permissions/disablement for identities already admitted by application
32
+ configuration. Disabling a user revokes their browser sessions and agent grants.
33
+ The pages call Core's protected facade; no upstream credentials enter Streamlit.
34
+
35
+ The optional **MCP keys** page requires `system.auth.mcp_keys` and manages named
36
+ 256-bit bearer keys through core's separate MCP auth API. Install/enable
37
+ `toolframe-mcp-auth` to generate keys, select business scopes and expiry, copy each
38
+ secret once and revoke it later. `system.settings.manage` also permits changing
39
+ the independent MCP public/protected policy. The page remains available for policy
40
+ recovery when the MCP auth provider is absent. See the MCP authentication guide
41
+ in the core repository for configuration details.
42
+
43
+ The management page fills in an editable **Unnamed password** label, adding a
44
+ number for names already in use. The password field accepts 8–32 characters and
45
+ shows a stable random suggestion as its placeholder. Leave the field blank to use
46
+ that exact suggestion; after creation, copy the one-time displayed password.
47
+ Failed submissions preserve the draft; successful creation starts a fresh one.
48
+
49
+ **Set expiry** immediately reveals a duration and unit side by side, with minutes,
50
+ hours, days, weeks or calendar months and a calculated local expiry preview.
51
+ Preview and record timestamps use the browser's timezone (its UTC offset is a
52
+ fallback, then UTC if neither is available). Durations start when saved; months
53
+ follow that local calendar and clamp to the destination month's last day. Other
54
+ units measure elapsed time, including across daylight-saving changes. No
55
+ date/time entry is needed.
56
+ Turning expiry off hides the controls and saves no expiry. When editing, leave the
57
+ duration blank to preserve the exact existing expiry, or enter a duration to
58
+ replace it. Saving other grant fields never silently extends the expiry.
59
+
60
+ The page selects scopes, edits grants, revokes records and shows creation,
61
+ last-login and last-use timestamps. Its page
62
+ requires `system.auth.passwords`; access-policy controls additionally require
63
+ `system.settings.manage`. Core/auth enforce the same rules beyond the UI.
64
+
65
+ Core serves the login page at `/_toolframe/auth/login`. The existing Dashboard
66
+ provider owns the common local/public/protected header so it remains available
67
+ when this integration fails or is disabled. Streamlit is supplied by the shared
68
+ Dashboard execution environment, not the business/auth worker.
69
+
70
+ ```sh
71
+ uv sync
72
+ uv run pytest -q
73
+ uv run ruff check src tests
74
+ uv build --wheel
75
+ ```
76
+
77
+ For the same isolated validation used by GitHub Actions, run `bash scripts/ci.sh`
78
+ with Python 3.14.7, uv 0.12.8 and a sibling `toolframe-sdk` Git checkout available.
79
+ This runs the presentation tests against a newly built wheel, checks both
80
+ distributions, and verifies a separate installation with only runtime dependencies.
81
+ See [CI and publishing](docs/ci.md) for the pinned SDK revision, workflow triggers,
82
+ release prerequisites and local validation limits.
83
+
84
+ For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
85
+
86
+ ## License
87
+
88
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,103 @@
1
+ # CI and publishing
2
+
3
+ ## Run the CI checks locally
4
+
5
+ Use Git, Bash, Python **3.14.7** and uv **0.12.8**, with network access to PyPI.
6
+ The SDK checkout must contain commit
7
+ `ef91b609137a5fe7bae8e0c893e74b096ff06ffe` (SDK 0.3.0).
8
+
9
+ ```sh
10
+ uv python install 3.14.7
11
+ bash scripts/ci.sh
12
+ ```
13
+
14
+ By default the script reads `../toolframe-sdk`. To use a different checkout:
15
+
16
+ ```sh
17
+ TOOLFRAME_SDK_REPOSITORY=/absolute/path/to/toolframe-sdk bash scripts/ci.sh
18
+ ```
19
+
20
+ Each invocation creates and prints a new temporary workspace. It copies this
21
+ working tree and archives the exact SDK commit there; it does not build from
22
+ the SDK's current working tree. It leaves both original repositories, their
23
+ lockfiles, existing `.venv` directories and existing `dist` directories alone.
24
+ The temporary workspace is retained on success or failure for inspection.
25
+
26
+ The script performs these checks, stopping on any failure:
27
+
28
+ 1. Export the existing `uv.lock` with `uv export --locked`, retaining the locked
29
+ development dependency versions, including Streamlit 1.61.0. Exclude the two
30
+ editable project entries because fresh wheels supply them instead.
31
+ 2. Build the SDK wheel and this project's sdist and wheel with `uv build
32
+ --no-sources`. The project wheel is built from its sdist by uv's default build
33
+ sequence. All build directories and the uv cache start empty.
34
+ 3. Install the new SDK and plugin wheels with the `ui` extra, locked development
35
+ dependencies and Twine 7.0.0 into a new test environment, compiling dependency
36
+ bytecode before the existing Streamlit AppTest deadlines start. Run `uv pip check`,
37
+ `ruff check src tests scripts`, all existing presentation tests via
38
+ `python -I -m pytest -q -p no:cacheprovider --durations=5 <copied-source>/tests`
39
+ from an empty working directory, and
40
+ `twine check --strict` on both distributions.
41
+ 4. Install both wheels into another empty environment with their real runtime
42
+ dependencies. Run `uv pip check` and the wheel smoke check from outside the
43
+ source tree using Python's isolated mode. Check installed module paths,
44
+ versions, plugin discovery, scoped management-page metadata, bundled password
45
+ login HTML, and the unchanged Apache-2.0 `LICENSE` and `NOTICE` files.
46
+
47
+ The runtime smoke environment contains no Streamlit or development tools; the
48
+ presentation tests exercise Streamlit in the test environment. Neither install
49
+ uses `--no-deps`. Only this project's two distributions are upload artifacts;
50
+ the SDK wheel is a local validation dependency and is never uploaded by this repo.
51
+ Twine is pinned to 7.0.0 for its
52
+ [Metadata 2.5 compatibility fix](https://twine.readthedocs.io/en/stable/changelog.html#twine-7-0-0-2026-07-27).
53
+
54
+ Workflow and shell syntax checks can also be run from the repository root:
55
+
56
+ ```sh
57
+ actionlint .github/workflows/*.yml
58
+ bash -n scripts/ci.sh
59
+ python3.14 scripts/check_release_tag.py refs/tags/v0.1.3
60
+ ```
61
+
62
+ ## GitHub Actions
63
+
64
+ `ci.yml` handles pull requests, pushes (including tags), and manual runs. It calls
65
+ `validate.yml`, which runs the same local script on `ubuntu-24.04` and `macos-15`,
66
+ with Python 3.14.7 and uv 0.12.8. These labels appear in the
67
+ [official runner list](https://docs.github.com/en/actions/reference/runners/github-hosted-runners).
68
+ Successful Linux validation retains the wheel and sdist for seven days as
69
+ `dashboard-auth-dist-<commit SHA>`. Both matrix jobs must pass for validation to
70
+ succeed. Jobs have bounded timeouts and default to `contents: read`.
71
+
72
+ All external actions use full commit pins with version comments. Checkouts do not
73
+ persist credentials. CI concurrency cancels superseded runs; the reusable
74
+ workflow has no concurrency group and cannot cancel its caller. There is no
75
+ `pull_request_target` execution or automatic publishing from PRs or tag pushes.
76
+
77
+ Before remote runs, push this repository and the pinned SDK commit to the chosen
78
+ GitHub owner. The dependency repository must be named `toolframe-sdk`; its owner
79
+ defaults to `github.repository_owner`. Set the repository Actions variable
80
+ `TOOLFRAME_REPOSITORY_OWNER` if the SDK lives under another trusted owner. Fork
81
+ PRs still fetch from this configured/base owner, never the PR author's owner.
82
+ Public siblings need no additional token. For private SDK access, configure the
83
+ read-only `TOOLFRAME_READ_TOKEN` described in [releasing](releasing.md). The
84
+ current repository's `GITHUB_TOKEN` cannot read a different private repository.
85
+
86
+ ## Publication
87
+
88
+ See [releasing](releasing.md) for dependency order, private repository access,
89
+ Trusted Publisher bindings, version tags and consumer installation checks.
90
+
91
+ ## Validation limits
92
+
93
+ Local validation runs on the host executing the script. Passing it on an Apple
94
+ Silicon Mac does not claim an executed GitHub Linux/macOS matrix, Windows or
95
+ physical Intel support, full Core/auth integration, browser automation, or an
96
+ actual OIDC upload. Presentation behavior is covered by the existing Streamlit
97
+ AppTest suite; authentication enforcement remains owned by Core/auth. Preparing
98
+ these files does not push commits, create tags remotely, register publishers or
99
+ deploy a release.
100
+
101
+ The first Streamlit AppTest render has a bounded 60-second timeout to allow
102
+ cold native-library imports. Later interactions retain their shorter timeout;
103
+ assertions remain active and the suite does not retry failures.