.agents/skills/auth-authorization/SKILL.md
Trace or modify Madoc TS authentication and authorization. Use when working on login strategies, JWT parsing/verification, cookie handling, or route-level authorization in services/madoc-ts.
npx skillsauth add digirati-co-uk/madoc-platform auth-authorizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Document how Madoc TS authenticates users, parses/verifies JWTs, and applies authorization in middleware and route handlers.
services/madoc-ts/src/auth-server.tsservices/madoc-ts/src/auth/index.ts, services/madoc-ts/src/auth/github.tsservices/madoc-ts/src/auth/utils/login-with-provider.tsservices/madoc-ts/src/middleware/parse-jwt.tsservices/madoc-ts/src/middleware/set-jwt.tsservices/madoc-ts/src/utility/verify-signed-token.tssrc/auth/index.ts and exposed via getAuthRoutes().koa-passport and passport-github2 in src/auth/github.ts.GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, and GITHUB_CLIENT_CALLBACK_URL are set.loginWithProvider, which:
user table (federated_logins JSON column).context.siteManager.getVerifiedLogin and sets context.state.authenticatedUser./ after successful login.verifySignedToken (RS256, public key from getPublicPem).parseJwt middleware:
/s/:slug/...).context.siteManager.refreshExpiredToken and sets new cookies.getToken() and verifies it (normally gateway-verified but rechecked here).context.state.jwt and context.state.user when a token is valid.NotAuthorized if a non-site request lacks a valid token.setJwt middleware sets auth cookies for authenticated users when no JWT is present yet.auth/index.ts to see registered strategies and routes.auth/github.ts) and include it in strategies.login-with-provider.ts to see how federated login is linked to a user and how session cookies are set.parse-jwt.ts for cookie parsing, token refresh, and fallback token verification.verify-signed-token.ts.parse-jwt control flow)context.state.jwt settools
Work on Madoc TS shared utility helpers (JWT, metadata, errors, IIIF helpers, auth helpers). Use when changing core utility functions or shared helpers in services/madoc-ts.
development
Work on Madoc TS shared type definitions and schema contracts. Use when updating TypeScript types, JSON schema shapes, or cross-layer data contracts in services/madoc-ts.
tools
Understand and extend Madoc TS task automation, including bots and task-related extensions. Use when adding task automation, bot behavior, or task metadata resolution in services/madoc-ts.
development
Work on Madoc TS site SSR pipeline, HTML template injection, and site render data wiring. Use when changing site SSR behavior, template tokens, or site SSR data wiring in services/madoc-ts.