Add an internal CredentialBroker that serializes refresh and authorization by environment/app/user using renewable Redis leases. Re-read credentials under the lease and persist rotated pairs with expected-version CAS before returning an explicit access-only grant. Verify the actual platform user, remaining lifetime and scopes; never return refresh tokens from the broker. Persist source-version refresh attempts before platform calls. Timeouts, cancellation, lease loss, malformed responses and ambiguous database errors fence reuse of the old rotating refresh token, including after restart. A new authorization can establish a new version without stale overwrite. Add a strict, separate private Work v1 OIDC adapter while preserving legacy OAuth method behavior. Enable fakeredis Lua test support for Redis lease renewal tests. Document stage boundaries, recovery limitations and testing. Validation: 147 passed, 2 skipped (real PostgreSQL not configured), with 15 existing uvicorn/websockets deprecation warnings. New broker/adapter coverage: 45 tests. AST, runtime opt-in boundary and diff checks pass. An earlier Windows temp-file replace failure in a legacy client test passed both isolated rerun and the final full suite; no client code was changed. No public credential/OAuth routes are wired, no production database/key is initialized, and no real Work authorization, refresh or ECS deployment was performed. Authenticated access-token issuance, state transactions, binding checks and unbind integration remain subsequent stages.
33 lines
831 B
TOML
33 lines
831 B
TOML
[build-system]
|
|
requires = ["setuptools>=75"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "hainuo-relay"
|
|
version = "0.1.0"
|
|
description = "Hainuo isolated connector and encrypted device router"
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"fastapi==0.119.1", "uvicorn==0.38.0", "httpx==0.28.1",
|
|
"redis==6.4.0", "cryptography==46.0.3", "websockets==15.0.1",
|
|
"pydantic-settings==2.11.0",
|
|
"psycopg[binary]==3.2.12",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
test = ["pytest==8.4.2", "pytest-asyncio==1.2.0", "fakeredis[lua]==2.32.0"]
|
|
longconn = ["lark-oapi==1.5.3"]
|
|
|
|
[project.scripts]
|
|
hainuo-relay = "relay.cli:main"
|
|
|
|
[tool.setuptools.packages.find]
|
|
include = ["relay*"]
|
|
|
|
[tool.setuptools.package-data]
|
|
relay = ["web/*.html", "web/*.js", "web/*.css"]
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|