feat: add auth admin mutations
This commit is contained in:
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user