tba-router-wic-ca 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.
- tba_router_wic_ca-0.4.0.dev2/PKG-INFO +57 -0
- tba_router_wic_ca-0.4.0.dev2/README.md +38 -0
- tba_router_wic_ca-0.4.0.dev2/pyproject.toml +19 -0
- tba_router_wic_ca-0.4.0.dev2/src/tba_router_wic_ca/__init__.py +3 -0
- tba_router_wic_ca-0.4.0.dev2/src/tba_router_wic_ca/binding.py +37 -0
- tba_router_wic_ca-0.4.0.dev2/src/tba_router_wic_ca/py.typed +1 -0
- tba_router_wic_ca-0.4.0.dev2/src/tba_router_wic_ca/schemas.py +11 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-router-wic-ca
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Mountable native WIMSE WIC 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-wic-ca
|
|
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-wic-ca/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-wic-ca/pyproject.toml"><img alt="Python: >=3.10,<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-wic-ca/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-wic-ca/"><img alt="PyPI version for tba-router-wic-ca" src="https://img.shields.io/pypi/v/tba-router-wic-ca?label=tba-router-wic-ca%20PyPI"></a>
|
|
31
|
+
</p>
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://pepy.tech/project/tba-router-wic-ca"><img alt="Monthly PyPI downloads for tba-router-wic-ca" src="https://static.pepy.tech/badge/tba-router-wic-ca/month"></a>
|
|
34
|
+
<a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wic-ca/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_wic_ca_router(service=..., authenticate=...)` on a Tigrbl app.
|
|
39
|
+
`POST /wic/issue` accepts JSON with `csr_pem` and returns `certificate_pem`.
|
|
40
|
+
The async authenticator must return a trusted enrollment principal or `None`.
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
Build the package from the repository root:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv build --wheel pkgs/80-routers/tba-router-wic-ca
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Verification
|
|
51
|
+
|
|
52
|
+
Exercise native WIC issuance and WIT/WPT runtime composition from the repository root:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv run --extra test pytest pkgs/120-tests/tba-tests-workload-composition/tests/test_native_wimse_services.py
|
|
56
|
+
```
|
|
57
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# tba-router-wic-ca
|
|
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-wic-ca/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-wic-ca/pyproject.toml"><img alt="Python: >=3.10,<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-wic-ca/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-wic-ca/"><img alt="PyPI version for tba-router-wic-ca" src="https://img.shields.io/pypi/v/tba-router-wic-ca?label=tba-router-wic-ca%20PyPI"></a>
|
|
13
|
+
</p>
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://pepy.tech/project/tba-router-wic-ca"><img alt="Monthly PyPI downloads for tba-router-wic-ca" src="https://static.pepy.tech/badge/tba-router-wic-ca/month"></a>
|
|
16
|
+
<a href="https://github.com/tigrbl/tigrbl_auth/blob/master/pkgs/80-routers/tba-router-wic-ca/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_wic_ca_router(service=..., authenticate=...)` on a Tigrbl app.
|
|
21
|
+
`POST /wic/issue` accepts JSON with `csr_pem` and returns `certificate_pem`.
|
|
22
|
+
The async authenticator must return a trusted enrollment principal or `None`.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
Build the package from the repository root:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv build --wheel pkgs/80-routers/tba-router-wic-ca
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Verification
|
|
33
|
+
|
|
34
|
+
Exercise native WIC issuance and WIT/WPT runtime composition from the repository root:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run --extra test pytest pkgs/120-tests/tba-tests-workload-composition/tests/test_native_wimse_services.py
|
|
38
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-router-wic-ca"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "Mountable native WIMSE WIC 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_wic_ca", from = "src" }]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""HTTP binding for native WIMSE WIC 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.wic_service import WicIssuanceService
|
|
9
|
+
|
|
10
|
+
from .schemas import WicIssueRequest, WicIssueResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def build_wic_ca_router(
|
|
14
|
+
*,
|
|
15
|
+
service: WicIssuanceService,
|
|
16
|
+
authenticate: Callable[[Request], Awaitable[str | None]],
|
|
17
|
+
) -> TigrblRouter:
|
|
18
|
+
router = TigrblRouter()
|
|
19
|
+
|
|
20
|
+
@router.route("/wic/issue", methods=["POST"], response_model=WicIssueResponse)
|
|
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 = WicIssueRequest.model_validate(await request.json())
|
|
27
|
+
if not body.csr_pem.startswith("-----BEGIN "):
|
|
28
|
+
raise ValueError("expected a PEM CSR")
|
|
29
|
+
certificate = await service.issue(principal, body.csr_pem.encode("ascii"))
|
|
30
|
+
payload = WicIssueResponse(certificate_pem=certificate.decode("ascii"))
|
|
31
|
+
except PermissionError as exc:
|
|
32
|
+
raise HTTPException(403, "workload issuance denied") from exc
|
|
33
|
+
except ValueError as exc:
|
|
34
|
+
raise HTTPException(400, "invalid workload credential request") from exc
|
|
35
|
+
return JSONResponse(payload.model_dump(), headers={"Cache-Control": "no-store"})
|
|
36
|
+
|
|
37
|
+
return router
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class WicIssueRequest(BaseModel):
|
|
5
|
+
model_config = ConfigDict(extra="forbid", strict=True)
|
|
6
|
+
|
|
7
|
+
csr_pem: str = Field(min_length=1, max_length=16384)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WicIssueResponse(BaseModel):
|
|
11
|
+
certificate_pem: str
|