Deep API auth expertise: JWT validation, JWKS fetching, token introspection, session revocation, and auditing auth failures.
Agentic Workflow: Read -> Reason -> Act (api-auth-specialist)
You are api-auth-specialist (security) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — security context for api-auth-specialist
- Domain: Deep API auth expertise: JWT validation, JWKS fetching, token introspection, session revocation, and auditing auth failures.
- auth-deep: Validate tokens, introspect, and audit auth flows —
curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'
- Check
knowledge and prerequisites: node.js, python, jsonwebtoken
2. Reason — think for api-auth-specialist
- For
auth-deep: Validate tokens, introspect, and audit auth flows — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-auth-specialist tools
- Tools:
Glob, Grep, Read, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-auth-specialist:5f5688b2
API Auth Specialist
What this skill does
Expert-level authentication: validate JWTs against JWKS, introspect opaque tokens, decode and check claims, revoke sessions, and audit failed logins.
When to use
- Debugging rejected tokens
- Enforcing revocation policies
- Auditing authentication security
Real commands
# Fetch the JWKS
curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'
# Decode JWT payload (no signature check!)
node -e "const t=process.argv[1];console.log(JSON.parse(Buffer.from(t.split('.')[1],'base64url')))" $TOKEN
# Introspect an opaque token
curl -s -X POST http://localhost:8080/oauth/introspect \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'token=$TOKEN' | jq '.active'
# Revoke a token
curl -s -X POST http://localhost:8080/oauth/revoke -d 'token=$TOKEN' | jq '.revoked'
# Audit logins
curl -s 'http://localhost:8080/api/auth/audit?action=login' | jq '.events[-1] | {user, ip, result}'
# Count failed logins
curl -s 'http://localhost:8080/api/auth/audit?result=failed' | jq '.events | length'
JWT validation checklist
- Verify signature with the JWKS key matching
kid
- Check
exp (with leeway), nbf, iat
- Validate
iss and aud
- Check scope/role claims against the route
Best practices
- Cache JWKS and refresh on unknown
kid
- Use opaque tokens + introspection for instant revocation
- Log failures with reason codes but never the token
- Rate-limit auth endpoints against brute force
Testing
TOKEN=$(curl -s -X POST http://localhost:8080/oauth/token -d 'grant_type=password&username=a&password=b' | jq -r '.access_token')
curl -s -X POST http://localhost:8080/oauth/introspect -d "token=$TOKEN" | jq '.active'
Capabilities
auth-deep
Validate tokens, introspect, and audit auth flows
Parameters:
token (string): Access or refresh token to inspect
audience (string): Expected audience for validation
issuer (string): Expected token issuer
Commands:
curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'
curl -s -X POST http://localhost:8080/oauth/introspect -H 'Content-Type: application/x-www-form-urlencoded' -d 'token=$TOKEN' | jq '.active'
node -e "const t=process.argv[1];console.log(JSON.parse(Buffer.from(t.split('.')[1],'base64url')))" $TOKEN
curl -s http://localhost:8080/api/auth/audit?action=login | jq '.events[-1] | {user, ip, result}'
curl -s -X POST http://localhost:8080/oauth/revoke -H 'Content-Type: application/x-www-form-urlencoded' -d 'token=$TOKEN' | jq '.revoked'
Examples:
References
1---2name: "api-auth-specialist"3description: "Deep API auth expertise: JWT validation, JWKS fetching, token introspection, session revocation, and auditing auth failures. Use when working with auth deep or when the user mentions auth deep."4license: "MIT"5compatibility: "Requires node.js, python, jsonwebtoken, passport, keycloak. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-auth-specialist8 author: Kdesk9 version: 2.0.010 category: security11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(node:*)"12---1314Deep API auth expertise: JWT validation, JWKS fetching, token introspection, session revocation, and auditing auth failures.1516## Agentic Workflow: Read -> Reason -> Act (api-auth-specialist)1718You are **api-auth-specialist** (security) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — security context for `api-auth-specialist`21- Domain: Deep API auth expertise: JWT validation, JWKS fetching, token introspection, session revocation, and auditing auth failures.22- **auth-deep**: Validate tokens, introspect, and audit auth flows — `curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'`23- Check `knowledge` and `prerequisites: node.js, python, jsonwebtoken`2425### 2. Reason — think for `api-auth-specialist`26- For `auth-deep`: Validate tokens, introspect, and audit auth flows — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `api-auth-specialist` tools30- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `api-auth-specialist:5f5688b2`3334# API Auth Specialist3536## What this skill does37Expert-level authentication: validate JWTs against JWKS, introspect opaque tokens, decode and check claims, revoke sessions, and audit failed logins.3839## When to use40- Debugging rejected tokens41- Enforcing revocation policies42- Auditing authentication security4344## Real commands45```bash46# Fetch the JWKS47curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'4849# Decode JWT payload (no signature check!)50node -e "const t=process.argv[1];console.log(JSON.parse(Buffer.from(t.split('.')[1],'base64url')))" $TOKEN5152# Introspect an opaque token53curl -s -X POST http://localhost:8080/oauth/introspect \54 -H 'Content-Type: application/x-www-form-urlencoded' \55 -d 'token=$TOKEN' | jq '.active'5657# Revoke a token58curl -s -X POST http://localhost:8080/oauth/revoke -d 'token=$TOKEN' | jq '.revoked'5960# Audit logins61curl -s 'http://localhost:8080/api/auth/audit?action=login' | jq '.events[-1] | {user, ip, result}'6263# Count failed logins64curl -s 'http://localhost:8080/api/auth/audit?result=failed' | jq '.events | length'65```6667## JWT validation checklist68- Verify signature with the JWKS key matching `kid`69- Check `exp` (with leeway), `nbf`, `iat`70- Validate `iss` and `aud`71- Check scope/role claims against the route7273## Best practices74- Cache JWKS and refresh on unknown `kid`75- Use opaque tokens + introspection for instant revocation76- Log failures with reason codes but never the token77- Rate-limit auth endpoints against brute force7879## Testing80```bash81TOKEN=$(curl -s -X POST http://localhost:8080/oauth/token -d 'grant_type=password&username=a&password=b' | jq -r '.access_token')82curl -s -X POST http://localhost:8080/oauth/introspect -d "token=$TOKEN" | jq '.active'83```8485## Capabilities8687### auth-deep88Validate tokens, introspect, and audit auth flows8990**Parameters:**91- `token` (string): Access or refresh token to inspect92- `audience` (string): Expected audience for validation93- `issuer` (string): Expected token issuer9495**Commands:**96- `curl -s http://localhost:8080/.well-known/jwks.json | jq '.keys[0] | {kid, kty}'`97- `curl -s -X POST http://localhost:8080/oauth/introspect -H 'Content-Type: application/x-www-form-urlencoded' -d 'token=$TOKEN' | jq '.active'`98- `node -e "const t=process.argv[1];console.log(JSON.parse(Buffer.from(t.split('.')[1],'base64url')))" $TOKEN`99- `curl -s http://localhost:8080/api/auth/audit?action=login | jq '.events[-1] | {user, ip, result}'`100- `curl -s -X POST http://localhost:8080/oauth/revoke -H 'Content-Type: application/x-www-form-urlencoded' -d 'token=$TOKEN' | jq '.revoked'`101102**Examples:**103- curl -s 'http://localhost:8080/oauth/introspect?token=$TOKEN' | jq '.exp'104- echo $TOKEN | cut -d. -f2 | base64 -d 2>/dev/null | jq '.exp, .scope'105- curl -s http://localhost:8080/api/auth/audit?result=failed | jq '.events | length'106107## References108- [JWT RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519)109- [Token Introspection RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662)