Skip to content

Authentication Flows

This section documents the various authentication flows in GrydAuth. Each flow includes detailed sequence diagrams showing the interaction between components.

Overview

GrydAuth supports multiple authentication scenarios to handle different user states and requirements:

Flow Decision Tree

The following diagram shows how GrydAuth determines which flow to execute:

100% 💡 Use Ctrl + Scroll para zoom | Arraste para navegar

Quick Reference

FlowTriggerToken TypeExpiration
Standard LoginDefault tenant existsFull JWTConfigurable (default: 1h)
First LoginMustChangePassword = trueTemporary10 minutes
Switch TenantNo default tenantPre-Auth5 minutes
Refresh TokenAccess token expiredNew JWTResets expiration
LogoutUser/admin actionN/AImmediate invalidation

Common Components

All flows share these core components:

Security Service

Handles:

  • Password verification (BCrypt/Argon2)
  • Password strength validation
  • Failed attempt tracking
  • Account lockout

JWT Service

Generates and validates:

  • Access tokens (short-lived)
  • Refresh tokens (long-lived)
  • Temporary tokens (purpose-specific)
  • Pre-auth tokens (tenant selection)

Token Claims

Standard JWT claims included in access tokens:

json
{
  "sub": "user-id-guid",
  "email": "user@example.com",
  "tenant_id": "tenant-id-guid",
  "tenant_name": "Acme Corp",
  "roles": ["Admin", "User"],
  "permissions": ["users:read", "users:write"],
  "token_version": 1,
  "iat": 1706882400,
  "exp": 1706886000
}

Additional Flows

More authentication flows coming soon:

  • Reset Password - Self-service password recovery
  • Social Login - OAuth/OIDC with Auth0
  • API Key Authentication - Service-to-service auth
  • Two-Factor Authentication - TOTP/SMS verification

Released under the MIT License.