feat: add auth admin mutations

This commit is contained in:
lda
2026-06-06 16:49:34 +07:00 Verified
parent 56104c7849
commit f137b8fcb2
17 changed files with 627 additions and 15 deletions
+12 -1
View File
@@ -4,13 +4,14 @@ from dataclasses import dataclass
from typing import Any
from wf_api import WorkflowAdminAuthProvider
from wf_api.auth import AuthRecord as NeutralAuthRecord
from ...storage import Store
@dataclass(frozen=True, slots=True)
class McpAuthAdminProvider(WorkflowAdminAuthProvider):
"""Read-only auth inventory for MCP-backed workflow servers.
"""Auth inventory and local/dev mutation for MCP-backed workflow servers.
Summaries intentionally expose payload keys, not payload values. Concrete
auth variants can provide richer safe display later.
@@ -35,5 +36,15 @@ class McpAuthAdminProvider(WorkflowAdminAuthProvider):
"payload_keys": sorted(str(key) for key in record.payload),
}
def save_auth_record(self, record: NeutralAuthRecord) -> dict[str, Any]:
self.store.save_auth_record(record)
return self.inspect_auth_record(record.id)
def delete_auth_record(self, auth_ref: str) -> dict[str, Any]:
deleted = self.store.delete_auth_record(auth_ref)
if not deleted:
raise KeyError(f"unknown auth record {auth_ref!r}")
return {"deleted": True, "id": auth_ref}
__all__ = ["McpAuthAdminProvider"]