Files
query-orchestration/internal/cognitoauth
Michael McGuinness f5061f53db Merged in feature/timeout (pull request #138)
Remove race conditions from -race in tests

* timeout

* raceconditions

* nobuildgp

* build

* perf
2025-05-12 15:11:50 +00:00
..
2025-04-29 14:09:33 -07:00
2025-04-24 13:28:49 -07:00
2025-04-24 13:28:49 -07:00
2025-04-22 10:01:37 -07:00
2025-04-24 13:28:49 -07:00
2025-04-08 16:27:06 -07:00
2025-04-22 10:01:37 -07:00
2025-04-24 13:28:49 -07:00
2025-04-16 13:42:37 -07:00
2025-04-16 12:04:47 -07:00
2025-04-22 10:01:37 -07:00
2025-04-24 13:28:49 -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.

Package details

For a detailed explanation of all of the files in this package see the summary file.

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 (us-east-2)
  • DEBUG: Set to "true" for debug logging

Feature flag

You can disable all of the auth features with the following environment variable: DISABLE_AUTH=true

Route Permissions

Route permissions are hard-coded in the route_permissions.go file.
In the future we may integrate this information into the swagger API document.