Files
query-orchestration/internal/cognitoauth
jay brown bf98a0971f auth fixes
middleware handles logout
2025-04-15 12:04:54 -07:00
..
2025-04-15 12:04:54 -07:00
2025-04-15 12:04:54 -07:00
2025-04-08 16:27:06 -07:00
2025-04-15 12:04:54 -07:00
2025-04-08 16:27:06 -07:00
2025-04-14 15:40:01 -07:00
2025-04-08 16:35:13 -07:00
2025-04-08 16:27:06 -07:00
2025-04-11 16:46:05 -07:00
2025-04-09 17:19:19 -07:00

Cognito Auth

A reusable Go package for AWS Cognito authentication and authorization with Echo framework using PKCE flow.

Features

  • Complete OAuth 2.0 PKCE flow for AWS Cognito
  • JWT token validation and verification
  • Route-based authorization using Cognito user groups
  • Middleware for token handling
  • Cookie-based token storage
  • Default home page with authentication status
  • Simple integration with Echo framework

Feature flag for Auth

To disable all of these features for all endpoints you must set DISABLE_AUTH=true in your environment.

Installation

go get github.com/yourusername/cognitoauth

Configuration

The package reads configuration from environment variables:

  • COGNITO_CLIENT_ID: Your AWS Cognito App Client ID
  • COGNITO_CLIENT_SECRET: Your AWS Cognito App Client Secret (optional for public clients)
  • COGNITO_USER_POOL_ID: Your AWS Cognito User Pool ID
  • COGNITO_DOMAIN: Your AWS Cognito domain
  • AWS_REGION: AWS region where your Cognito User Pool is located
  • DEBUG: Set to "true" for debug logging

Optional path configuration:

  • COGNITO_LOGIN_PATH: Path for login endpoint (default: "/login")
  • COGNITO_CALLBACK_PATH: Path for OAuth callback (default: "/