Skip to content

plugin api: api.auth.registerVerifier() — plugin-issued credentials accepted on pod resources #622

Open

Description

@melvincarvalho

Plugin seam for #621 (LWS), under #206.

Problem

The auth chain in src/auth/token.js is hardcoded: Solid-OIDC → LWS-CID → NIP-98 → Bearer-from-IdP. A plugin that issues its own credentials — the LWS authorization server's at+jwt access tokens, but equally a did:key verifier (#86) or any future scheme — has no way to make pod resources accept them. It can only authenticate requests under its own mount prefix.

Proposal

api.auth.registerVerifier({
  id: 'lws-at-jwt',
  // Cheap shape check so verifiers don't all parse every request.
  match(request) { return /^Bearer /i.test(request.headers.authorization) && looksLikeAtJwt(...); },
  // Returns an agent id (WebID / DID string) or null. Throw to reject with 401.
  async verify(request) { ... },
});
  • Registered verifiers run after the built-in chain, in registration order, before the Bearer-from-IdP fallback — so a plugin can't shadow OIDC or NIP-98.
  • Result feeds the same getWebIdFromRequestAsync path api.auth.getAgent already blesses (Plugin api: bless getWebIdFromRequestAsync as api.auth.getAgent (request → WebID) #584), so WAC sees the agent exactly as it would any other.
  • Verifier errors are logged with the plugin id and treated as "not this verifier", not as a hard 401, unless the verifier throws an explicit AuthError.

Why a seam, not core

The LWS AS belongs in the plugin (it's its own service with its own /.well-known), but its tokens must work on /alice/foo. Same shape as what Jesse needed in CSS (LwsAccessTokenExtractor plugged into the existing credentials extractor chain).

Prior art: Jesse's jeswr/LinkedWebStorage LwsAccessTokenExtractor.

Activity

  1. added
    enhancement
    plugin
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplugin

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions