tba-router-wit-issuance 0.4.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: tba-router-wit-issuance
3
+ Version: 0.4.0.dev2
4
+ Summary: Mountable native WIMSE WIT enrollment endpoint.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.10,<3.16
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Classifier: Programming Language :: Python :: 3.15
14
+ Requires-Dist: pydantic (>=2,<3)
15
+ Requires-Dist: tba-runtime-identity (==0.4.0.dev3)
16
+ Requires-Dist: tigrbl (==0.4.5.dev8)
17
+ Description-Content-Type: text/markdown
18
+
19
+ # tba-router-wit-issuance
20
+
21
+ <!-- BEGIN TBA README HEADER -->
22
+ <p align="center">
23
+ <a href="https://github.com/tigrbl/tigrbl_auth#readme"><img src="https://raw.githubusercontent.com/tigrbl/tigrbl_auth/master/docs/assets/tba-brand.png" alt="TBA · Tigrbl Auth" width="240"></a>
24
+ </p>
25
+ <p align="center">
26
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="Checkout: 0.4.0.dev2" src="https://img.shields.io/badge/Checkout-0.4.0.dev2-1f6feb"></a>
27
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.16" src="https://img.shields.io/badge/Python-%3E%3D3.10%2C%3C3.16-3776ab"></a>
28
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/License-Apache--2.0-525252"></a>
29
+ <a href="https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/80-routers"><img alt="Layer: 80 routers" src="https://img.shields.io/badge/Layer-80%20routers-0a7f5a"></a>
30
+ <a href="https://pypi.org/project/tba-router-wit-issuance/"><img alt="PyPI version for tba-router-wit-issuance" src="https://img.shields.io/pypi/v/tba-router-wit-issuance?label=tba-router-wit-issuance%20PyPI"></a>
31
+ </p>
32
+ <p align="center">
33
+ <a href="https://pepy.tech/project/tba-router-wit-issuance"><img alt="Monthly PyPI downloads for tba-router-wit-issuance" src="https://static.pepy.tech/badge/tba-router-wit-issuance/month"></a>
34
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/README.md#verification"><img alt="Evidence: verification" src="https://img.shields.io/badge/Evidence-verification-8250df"></a>
35
+ </p>
36
+ <!-- END TBA README HEADER -->
37
+
38
+ Mount `build_wit_issuance_router(service=..., authenticate=...)` on a Tigrbl app.
39
+ `POST /wit/issue` accepts JSON with `confirmation_jwk` and returns
40
+ `workload_identity_token`. The async authenticator supplies a trusted enrollment
41
+ principal. Construct `WitTokenService` with a configured signer, identity
42
+ resolver, and confirmation-key authorizer. The authorizer must bind the
43
+ presented public key to that principal, for example through a registered key
44
+ or an authenticated enrollment proof.
45
+
46
+ ## Quick start
47
+
48
+ Build the package from the repository root:
49
+
50
+ ```bash
51
+ uv build --wheel pkgs/80-routers/tba-router-wit-issuance
52
+ ```
53
+
54
+ ## Verification
55
+
56
+ Exercise native WIC issuance and WIT/WPT runtime composition from the repository root:
57
+
58
+ ```bash
59
+ uv run --extra test pytest pkgs/120-tests/tba-tests-workload-composition/tests/test_native_wimse_services.py
60
+ ```
61
+
@@ -0,0 +1,42 @@
1
+ # tba-router-wit-issuance
2
+
3
+ <!-- BEGIN TBA README HEADER -->
4
+ <p align="center">
5
+ <a href="https://github.com/tigrbl/tigrbl_auth#readme"><img src="https://raw.githubusercontent.com/tigrbl/tigrbl_auth/master/docs/assets/tba-brand.png" alt="TBA · Tigrbl Auth" width="240"></a>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="Checkout: 0.4.0.dev2" src="https://img.shields.io/badge/Checkout-0.4.0.dev2-1f6feb"></a>
9
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.16" src="https://img.shields.io/badge/Python-%3E%3D3.10%2C%3C3.16-3776ab"></a>
10
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/pyproject.toml"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/License-Apache--2.0-525252"></a>
11
+ <a href="https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/80-routers"><img alt="Layer: 80 routers" src="https://img.shields.io/badge/Layer-80%20routers-0a7f5a"></a>
12
+ <a href="https://pypi.org/project/tba-router-wit-issuance/"><img alt="PyPI version for tba-router-wit-issuance" src="https://img.shields.io/pypi/v/tba-router-wit-issuance?label=tba-router-wit-issuance%20PyPI"></a>
13
+ </p>
14
+ <p align="center">
15
+ <a href="https://pepy.tech/project/tba-router-wit-issuance"><img alt="Monthly PyPI downloads for tba-router-wit-issuance" src="https://static.pepy.tech/badge/tba-router-wit-issuance/month"></a>
16
+ <a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wit-issuance/README.md#verification"><img alt="Evidence: verification" src="https://img.shields.io/badge/Evidence-verification-8250df"></a>
17
+ </p>
18
+ <!-- END TBA README HEADER -->
19
+
20
+ Mount `build_wit_issuance_router(service=..., authenticate=...)` on a Tigrbl app.
21
+ `POST /wit/issue` accepts JSON with `confirmation_jwk` and returns
22
+ `workload_identity_token`. The async authenticator supplies a trusted enrollment
23
+ principal. Construct `WitTokenService` with a configured signer, identity
24
+ resolver, and confirmation-key authorizer. The authorizer must bind the
25
+ presented public key to that principal, for example through a registered key
26
+ or an authenticated enrollment proof.
27
+
28
+ ## Quick start
29
+
30
+ Build the package from the repository root:
31
+
32
+ ```bash
33
+ uv build --wheel pkgs/80-routers/tba-router-wit-issuance
34
+ ```
35
+
36
+ ## Verification
37
+
38
+ Exercise native WIC issuance and WIT/WPT runtime composition from the repository root:
39
+
40
+ ```bash
41
+ uv run --extra test pytest pkgs/120-tests/tba-tests-workload-composition/tests/test_native_wimse_services.py
42
+ ```
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "tba-router-wit-issuance"
3
+ version = "0.4.0.dev2"
4
+ description = "Mountable native WIMSE WIT enrollment endpoint."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10,<3.16"
7
+ license = "Apache-2.0"
8
+ dependencies = [
9
+ "tigrbl==0.4.5.dev8",
10
+ "pydantic>=2,<3",
11
+ "tba-runtime-identity==0.4.0.dev3",
12
+ ]
13
+
14
+ [build-system]
15
+ requires = ["poetry-core>=1.0.0"]
16
+ build-backend = "poetry.core.masonry.api"
17
+
18
+ [tool.poetry]
19
+ packages = [{ include = "tba_router_wit_issuance", from = "src" }]
@@ -0,0 +1,3 @@
1
+ from .binding import build_wit_issuance_router
2
+
3
+ __all__ = ["build_wit_issuance_router"]
@@ -0,0 +1,35 @@
1
+ """HTTP binding for native WIMSE WIT issuance."""
2
+
3
+ from collections.abc import Awaitable, Callable
4
+
5
+ from tigrbl import JSONResponse, Request, TigrblRouter
6
+ from tigrbl.runtime.status import HTTPException
7
+
8
+ from tba_runtime_identity.workload.wit_token_service import WitTokenService
9
+
10
+ from .schemas import WitIssueRequest, WitIssueResponse
11
+
12
+
13
+ def build_wit_issuance_router(
14
+ *,
15
+ service: WitTokenService,
16
+ authenticate: Callable[[Request], Awaitable[str | None]],
17
+ ) -> TigrblRouter:
18
+ router = TigrblRouter()
19
+
20
+ @router.route("/wit/issue", methods=["POST"], response_model=WitIssueResponse)
21
+ async def issue(request: Request):
22
+ principal = await authenticate(request)
23
+ if not principal:
24
+ raise HTTPException(401, "workload authentication required")
25
+ try:
26
+ body = WitIssueRequest.model_validate(await request.json())
27
+ token = await service.issue(principal, body.confirmation_jwk)
28
+ payload = WitIssueResponse(workload_identity_token=token)
29
+ except PermissionError as exc:
30
+ raise HTTPException(403, "workload issuance denied") from exc
31
+ except ValueError as exc:
32
+ raise HTTPException(400, "invalid workload credential request") from exc
33
+ return JSONResponse(payload.model_dump(), headers={"Cache-Control": "no-store"})
34
+
35
+ return router
@@ -0,0 +1,18 @@
1
+ from typing import Annotated
2
+
3
+ from pydantic import BaseModel, ConfigDict, Field, StringConstraints
4
+
5
+ JwkString = Annotated[str, StringConstraints(max_length=2048)]
6
+ JwkOperations = Annotated[list[JwkString], Field(max_length=16)]
7
+
8
+
9
+ class WitIssueRequest(BaseModel):
10
+ model_config = ConfigDict(extra="forbid", strict=True)
11
+
12
+ confirmation_jwk: dict[JwkString, JwkString | JwkOperations] = Field(
13
+ min_length=1, max_length=16
14
+ )
15
+
16
+
17
+ class WitIssueResponse(BaseModel):
18
+ workload_identity_token: str