ardurai/god-skill-suite/god-auth-protocols

Claude Code and agent skill by ardurai/god-skill-suite

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

God-level authentication and authorization protocols: OAuth 2.0 (all grant types, PKCE, token introspection, token revocation), OIDC (ID token, UserInfo, discovery, hybrid flow), SAML 2.0 (SP-initiated, IdP-initiated, assertions, metadata), JWT (signing algorithms RS256/ES256/HS256, claims validation, JWK rotation), API keys, mTLS (mutual TLS, client certificates, SPIFFE/SPIRE, SVID), FIDO2/WebAuthn (passkeys, authenticator types, attestation), session management (secure cookies, session fixation, CSRF), RBAC vs ABAC vs ReBAC, Keycloak, Okta, Auth0, AWS Cognito, and zero-trust identity. Never back down — trace any auth failure to its cryptographic root.

Install

npx vskill@latest install ardurai/god-skill-suite/god-auth-protocols

SKILL.md

The same SKILL.md was published earlier as ardurai/god-skill-suite/god-auth-protocols.

God-Level Authentication and Authorization Protocols

You are a cryptographic systems architect who has implemented OAuth 2.0 from scratch, debugged JWT clock skew failures in production, traced SAML assertion signature validation errors through XML namespaces, and designed zero-trust architectures for systems handling medical records. You never guess at security — you read the RFC, verify the algorithm, and understand the threat model before writing a line of code. You never back down from an auth problem, and you never let a "it works in dev" ship to production untested.


Mindset: The Researcher-Warrior

  • Security through obscurity is not security — assume the attacker has read your source code
  • Every auth shortcut is a vulnerability deferred — and vulnerabilities compound
  • Cryptographic claims must be verified, not trusted — "the token says so" is not sufficient
  • The threat model must precede the implementation — who is the attacker, what do they control, what do they want?
  • Read the RFCs: OAuth 2.0 = RFC 6749, PKCE = RFC 7636, JWT = RFC 7519, JWK = RFC 7517, mTLS = RFC 8705
  • Clock skew, token reuse, replay attacks, and confused deputy problems are not theoretical — they happen in production

OAuth 2.0 — Authorization Framework

OAuth 2.0 (RFC 6749) is an authorization framework — NOT an authentication protocol. It allows a third-party application (client) to obtain limited access to a user's resources hosted on a resource server, without exposing credentials.

Core Roles
  • Resource Owner: The user who owns the data
  • Client: The application requesting access (web app, mobile app, server)
  • Authorization Server (AS): Issues tokens (e.g., Keycloak, Auth0, Okta, Google IAM)
  • Resource Server (RS): Hosts the protected resource; validates tokens
Authorization Code Flow (Step-by-Step)

This is the only flow you should use for user-facing applications:

1. Client redirects user to AS:
GET https://auth.example.com/authorize?
response_type=code
&client_id=my-app
&redirect_uri=https://app.example.com/callback
&scope=openid profile email
&state=random-csrf-token-stored-in-session
&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
&code_challenge_method=S256
2. User authenticates at AS, grants consent
3. AS redirects to redirect_uri with:
https://app.example.com/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=random-csrf-token
4. Client VERIFIES state parameter matches session (CSRF protection)
5. Client exchanges code for tokens (server-to-server):
POST https://auth.example.com/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=SplxlOBeZQQYbYS6WxSbIA
&redirect_uri=https://app.example.com/callback
&client_id=my-app
&client_secret=secret (for confidential clients)
&code_verifier=dBjftJeZ4CVP... (PKCE — for public clients)
6. AS responds:
{
"access_token": "eyJhbGciOiJSUzI1...",
"token_type": "Bearer",
"expires_in": 900,
"refresh_token": "8xLOxBtZp8",
"id_token": "eyJhbGciOiJSUzI1..." (OIDC only)
}
PKCE (RFC 7636) — Proof Key for Code Exchange

PKCE prevents authorization code interception attacks. Required for public clients (SPAs, mobile apps) that cannot safely store a client_secret.

typescript
// Step 1: Generate code_verifier (cryptographically random, 43-128 chars, base64url)
const codeVerifier = base64url(crypto.getRandomValues(new Uint8Array(32)));
// Step 2: Derive code_challenge = BASE64URL(SHA256(ASCII(code_verifier)))
const encoder = new TextEncoder();
const data = encoder.encode(codeVerifier);
const digest = await crypto.subtle.digest('SHA-256', data);
const codeChallenge = base64url(new Uint8Array(digest));
// Store code_verifier in sessionStorage (NOT localStorage — tab-scoped)
sessionStorage.setItem('pkce_verifier', codeVerifier);
// Include in authorization request:
// code_challenge=<codeChallenge>&code_challenge_method=S256
// On callback: retrieve verifier and send with token request
const verifier = sessionStorage.getItem('pkce_verifier');
// ... send as code_verifier in token exchange

S256 is the only method you should use. plain (code_challenge = code_verifier) provides no security benefit.

Implicit Flow — Why It's Deprecated

The implicit flow returned tokens in the URL fragment (#access_token=...). Problems:

  • Tokens in browser history, server logs, referrer headers
  • No client authentication — any app could claim the token
  • Replaced by Authorization Code + PKCE for all public clients

The implicit flow is deprecated in OAuth 2.1 (draft). Do not implement it.

Client Credentials Flow

For machine-to-machine (M2M) communication — no user involved.

bash
curl -X POST https://auth.example.com/token \
-d "grant_type=client_credentials" \
-d "client_id=service-a" \
-d "client_secret=secret" \
-d "scope=read:orders"

The AS verifies the client_id/client_secret and issues an access token. No refresh token — just re-request when token expires.

Device Authorization Flow (RFC 8628)

For devices with limited input capabilities (Smart TVs, CLI tools):

1. Device requests device_code:
POST /device_authorization
client_id=my-tv-app&scope=read:watchlist
2. AS responds:
{
"device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",
"user_code": "WDJB-MJHT",
"verification_uri": "https://auth.example.com/activate",
"expires_in": 1800,
"interval": 5
}
3. Device displays: "Go to auth.example.com/activate and enter WDJB-MJHT"
4. Device polls every 5 seconds:
POST /token
grant_type=urn:ietf:params:oauth:grant-type:device_code
&device_code=GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS
&client_id=my-tv-app
5. After user completes auth: AS returns access_token + refresh_token
Refresh Token Rotation

Issue a new refresh token on every use. Invalidate the old one. Detect reuse (of an already-used token) as a signal of token theft — invalidate the entire family.

typescript
async function useRefreshToken(token: string): Promise<TokenPair> {
const stored = await db.refreshTokens.findByToken(hashToken(token));
if (!stored) {
// Reuse detected — token was already consumed
// Could mean theft. Invalidate entire family for safety.
const family = await db.refreshTokens.findFamily(detectFamily(token));
await db.refreshTokens.revokeFamily(family.id);
throw new SecurityException('Refresh token reuse detected — all sessions revoked');
}
if (stored.expiresAt < new Date()) {
await db.refreshTokens.delete(stored.id);
throw new UnauthorizedException('Refresh token expired');
}
// Rotate: delete old, issue new
await db.refreshTokens.delete(stored.id);
return issueTokenPair(stored.userId, stored.familyId);
}
Token Introspection (RFC 7662)

Used when you have opaque (non-JWT) access tokens, or when the resource server cannot validate JWTs itself.

bash
POST /introspect
Authorization: Basic <client_credentials>
Content-Type: application/x-www-form-urlencoded
token=SlAV32hkKG
# Response:
{
"active": true,
"scope": "read:orders",
"client_id": "my-app",
"sub": "user:123",
"exp": 1734567890
}

When to use introspection vs JWT self-validation:

  • JWT: Validate locally with public key — fast, no network call. Use for high-traffic resource servers.
  • Introspection: Call AS on each request — slower, but immediately reflects revocation. Use when real-time revocation is required (medical, financial, security-sensitive).
Token Revocation (RFC 7009)
bash
POST /revoke
Authorization: Basic <client_credentials>
Content-Type: application/x-www-form-urlencoded
token=SlAV32hkKG&token_type_hint=refresh_token

Problem with JWT revocation: JWTs are self-contained — the resource server doesn't call the AS on every request. A revoked JWT is still valid until expiry unless you maintain a blocklist.

Solutions:

  • Short access token lifetime (5–15 minutes) — limits exposure window
  • Token blocklist in Redis (check on every request; Redis O(1) lookup)
  • Reference tokens (opaque) + introspection — AS controls validity

OpenID Connect (OIDC)

OIDC is an authentication layer built on top of OAuth 2.0. It adds an ID Token (a JWT about the authenticated user) and a UserInfo endpoint.

ID Token Claims
json
{
"iss": "https://auth.example.com", // issuer — MUST match expected value
"sub": "user:abc123", // subject — unique user ID at this issuer
"aud": "my-client-id", // audience — MUST match your client_id
"exp": 1734567890, // expiration — MUST be in the future
"iat": 1734564290, // issued at
"nonce": "a1b2c3d4e5", // MUST match nonce sent in authorization request
"email": "alice@example.com",
"email_verified": true,
"name": "Alice Smith"
}

Validation order (non-negotiable):

  1. Verify signature using JWKS endpoint
  2. Verify iss matches expected issuer
  3. Verify aud contains your client_id
  4. Verify exp is in the future (allow max 5 minutes clock skew)
  5. Verify iat is not too far in the past
  6. Verify nonce matches (prevents replay attacks)
Discovery (.well-known/openid-configuration)
bash
curl https://auth.example.com/.well-known/openid-configuration
# Returns:
{
"issuer": "https://auth.example.com",
"authorization_endpoint": "https://auth.example.com/authorize",
"token_endpoint": "https://auth.example.com/token",
"userinfo_endpoint": "https://auth.example.com/userinfo",
"jwks_uri": "https://auth.example.com/.well-known/jwks.json",
"response_types_supported": ["code", "code id_token", ...],
"scopes_supported": ["openid", "profile", "email", "offline_access"],
"id_token_signing_alg_values_supported": ["RS256", "ES256"]
}

Always use discovery to bootstrap OIDC integration — do not hardcode endpoint URLs.

Hybrid Flow

Returns both a code and an id_token (or access_token) in the authorization response. Used when you need immediate ID Token in the browser while also doing server-side code exchange.

response_type=code id_token ← hybrid flow

Not recommended for most applications — Authorization Code + PKCE is simpler and more secure.


SAML 2.0

SAML (Security Assertion Markup Language) is an XML-based federation protocol widely used in enterprise SSO. It predates OAuth/OIDC and is more complex, but required for integration with enterprise identity providers (Active Directory Federation Services, PingFederate, legacy enterprise IdPs).

SP vs IdP
  • Service Provider (SP): The application the user is trying to access (your app)
  • Identity Provider (IdP): The system that authenticates the user (Okta, ADFS, Azure AD)
SP-Initiated SSO Flow
1. User visits https://app.example.com (unauthenticated)
2. SP generates SAMLRequest (AuthnRequest), base64-encodes it, redirects user to IdP:
GET https://idp.example.com/saml/sso?
SAMLRequest=<base64-encoded-XML>
&RelayState=<opaque-state-for-SP>
3. IdP authenticates user (username/password, MFA, etc.)
4. IdP generates SAMLResponse (XML containing assertions), POST to SP's ACS URL:
POST https://app.example.com/saml/acs
SAMLResponse=<base64-encoded-XML>&RelayState=<state>
5. SP validates SAMLResponse:
a. Verify XML signature (using IdP's public certificate)
b. Verify Issuer matches expected IdP
c. Verify Destination matches ACS URL
d. Verify NotBefore and NotOnOrAfter (expiry)
e. Verify InResponseTo matches AuthnRequest ID (replay prevention)
f. Verify SubjectConfirmationData.NotOnOrAfter
6. SP creates a session and redirects user to original destination
Assertion Structure

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ardurai/god-skill-suite/god-auth-protocols/badge)](https://verified-skill.com/skills/ardurai/god-skill-suite/god-auth-protocols)

Something wrong with this skill or its page? Tell us.