Some checks failed
Use-case regression gate / usecase-regressions (push) Has been cancelled
Assistant: codex Assistant-Model: gpt-6.1-sol Assistant-Session: 01a18e2d-f513-7742-b8e7-12af0b744ff3
37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
"""Actual owner HTTP/claims service with explicit in-memory/PDP fixture boundaries."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from wsgiref.simple_server import WSGIRequestHandler, make_server
|
|
|
|
from user_engine.adapters.claims import VerifiedIdentityClaimsAdapter
|
|
from user_engine.adapters.local import InMemoryUserEngineStore, LocalAuthorizationCheckPort
|
|
from user_engine.service import UserEngineService
|
|
from user_engine.web import PortalApplication
|
|
|
|
|
|
class Quiet(WSGIRequestHandler):
|
|
def log_message(self, *args):
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
assert {p.name for p in Path('/sys/class/net').iterdir()} == {'lo'}
|
|
v = json.loads(Path('/run/fixture/portal-input.json').read_text())
|
|
store = InMemoryUserEngineStore()
|
|
store.migrate()
|
|
service = UserEngineService(store=store, identity_adapter=VerifiedIdentityClaimsAdapter(
|
|
expected_issuer='http://127.0.0.1:8080', expected_audience='user-engine-portal'),
|
|
authorization=LocalAuthorizationCheckPort())
|
|
portal = PortalApplication(service, trusted_proxy_secret=v['proxy_secret'],
|
|
login_url='https://auth.recovery.test:9091')
|
|
|
|
def application(env, start):
|
|
if env['PATH_INFO'] == '/fixture/state':
|
|
data = json.dumps({'users': service.operability_snapshot().metrics['users']}).encode()
|
|
start('200 OK', [('Content-Type', 'application/json'),
|
|
('Content-Length', str(len(data)))])
|
|
return [data]
|
|
return portal(env, start)
|
|
|
|
make_server('127.0.0.1', 8089, application, handler_class=Quiet).serve_forever()
|