Skip to content

Add opt-in personal access token authentication - #31

Open
scaree wants to merge 9 commits into
mainfrom
85893_mcp_server
Open

Add opt-in personal access token authentication#31
scaree wants to merge 9 commits into
mainfrom
85893_mcp_server

Conversation

@scaree

@scaree scaree commented Jul 22, 2026

Copy link
Copy Markdown

Opt-in "personal_access_token" config section (disabled by default): sha256 hashed bearer tokens bound to a user with expiration, revocation, versioned auth cache, throttled last-used tracking, ownership voter, management controller and console commands for creation and expiry notifications (pluggable notifier interface with a no-op default). The entity ships as a mapped superclass targeting the contracts AnzuUser via resolve_target_entities; the host subclasses it and owns the table, indexes and migration.

scaree added 9 commits July 22, 2026 11:39
Opt-in "personal_access_token" config section (disabled by default): sha256
hashed bearer tokens bound to a user with expiration, revocation, versioned
auth cache, throttled last-used tracking, ownership voter, management
controller and console commands for creation and expiry notifications
(pluggable notifier interface with a no-op default). The entity ships as a
mapped superclass targeting the contracts AnzuUser via resolve_target_entities;
the host subclasses it and owns the table, indexes and migration.
Final constructor makes the class-string instantiation in the facade safe
and getUser() guards the nullable property explicitly.
The user_entity_class validation requires an existing AnzuUser subclass, so
the extension test uses a test entity instead of a nonexistent class name;
the facade test asserts the random token part without mangling the prefix.
…geApiTokenCommand

The personal access token create gate no longer hardcodes ROLE_MCP - hosts
using tokens for non-MCP integrations configure create_role instead. The
pre-existing class_exists guard on EntityManagerInterface never matched an
interface, so ChangeApiTokenCommand was silently unregistered.
Personal access token controller carries attribute routes like the other
auth controllers (host imports them with a prefix) and the expiry notifier
interface lives in Contracts next to the other extension interfaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant