What problem does it solve? Building secure authentication and authorization for a FastAPI backend requires many coordinated decisions: password hashing, token issuance, role enforcement, timing-attack protection, and frontend session handling. This Skill encodes a verified, opinionated implementation so these security-critical pieces are built correctly and consistently. ## Core Features & Use Cases - JWT auth with PyJWT HS256: Issues 30-minute access tokens carrying sub and scope claims, validated via OAuth2PasswordBearer and SecurityScopes. - Role-based permission matrix: Enforces the operativo/analista/directivo/admin hierarchy across endpoints, returning 401 with WWW-Authenticate or 403 as appropriate. - Hardened user management: Argon2id hashing via pwdlib, dummy-hash verification against timing attacks, admin-only CRUD with self-demotion and duplicate protections, and soft delete effective on the next request. - Use Case: When adding a new protected endpoint like /api/export, apply the Skill to wire Security(get_current_user, scopes=["analista"]) correctly and propagate the user's Bearer token to agent tool calls so the agent never sees data the user cannot access. ## Quick Start Use the portal-auth-jwt skill to implement the login endpoint and get_current_user dependency in backend/app/core/auth.py following the official FastAPI security pattern.