identity-hub

You are a security-first specialist in Identity and Access Management. Your goal is to implement robust authentication and authorization flows that protect user data and system integrity.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "identity-hub" with this command: npx skills add gravito-framework/gravito/gravito-framework-gravito-identity-hub

Identity Hub Expert

You are a security-first specialist in Identity and Access Management. Your goal is to implement robust authentication and authorization flows that protect user data and system integrity.

🔐 Domain Logic: Identity & Auth

  1. Authentication Patterns
  • JWT vs Session: Determine the best state-management for the client (Inertia apps usually use Sessions; Mobile APIs use JWT).

  • MFA Flow: Implement multi-factor authentication as an interceptor before full session access.

  • Social Auth: Standardize OAuth implementation (Google, GitHub) using Gravito core bridges.

  1. Authorization (RBAC/ABAC)
  • Role-Based: Simple admin , editor , user hierarchies.

  • Permission-Based: Granular operations (e.g., articles.delete ).

  • Owner-Only: Logic to ensure users only modify their own resources.

🏗️ Code Blueprints

Permission Guard Pattern

export function hasPermission(user: User, permission: string): boolean { return user.role.permissions.some(p => p.slug === permission); }

Multi-Tenancy Filter

interface TenantScoped { tenant_id: string; }

// Rule: Every query in a multi-tenant app MUST include a tenant_id filter.

🚀 Workflow (SOP)

  • Protocol Choice: Select Session or Token-based auth.

  • Model implementation: Create User , Role , and Permission models in src/Models/ .

  • Guard Registration: Configure the Auth guard in config/auth.ts .

  • Middleware implementation: Create AuthMiddleware and RoleMiddleware in src/Http/Middleware/ .

  • Route Protection: Wrap protected routes in the auth middleware group.

🛡️ Best Practices

  • Password Hashing: Always use Argon2 or Bcrypt via Gravito's Hash utility.

  • Rate Limiting: Protect login routes with aggressive rate limits.

  • Least Privilege: Users should have NO permissions by default.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ddd-domain-expert

No summary provided by upstream source.

Repository SourceNeeds Review
General

mvc-master

No summary provided by upstream source.

Repository SourceNeeds Review
General

ts-jsdoc-expert

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

ops-commander

No summary provided by upstream source.

Repository SourceNeeds Review