Skip to content

Refactor project structure and fix issues #60 and #67#70

Merged
developerkunal merged 7 commits intomasterfrom
refactor-project-structure
Jan 21, 2026
Merged

Refactor project structure and fix issues #60 and #67#70
developerkunal merged 7 commits intomasterfrom
refactor-project-structure

Conversation

@developerkunal
Copy link
Copy Markdown
Contributor

@developerkunal developerkunal commented Jan 19, 2026

🔧 Changes

Added a new modernized Go API sample (01-Quickstart-Go-API) with improved project structure and enhanced functionality:

New Sample Structure:

  • Go 1.24 with go-jwt-middleware v3
  • Standard cmd/ and internal/ package layout following Go best practices
  • Graceful shutdown handling and production-ready HTTP timeouts
  • Enhanced error handling with structured logging

Key Features:

  • CORS support using jwtmiddleware.WithValidateOnOptions(false) to handle preflight requests
  • Custom claims validation with scope-based authorization
  • Comprehensive RBAC setup documentation with visual screenshots
  • Environment-based configuration with validation

CI/CD Improvements:

  • Migrated from CircleCI to GitHub Actions
  • Both samples tested independently with correct port configurations
  • Added dependabot support for automated dependency updates

📚 References

🔬 Testing

Automated Testing:

  • All 21 tests passing in GitHub Actions for both samples
  • Legacy sample (01-Authorization-RS256) tested on port 3010
  • Modern sample (01-Quickstart-Go-API) tested on port 8080

Manual Testing:

  • Verified CORS preflight requests work correctly
  • Tested with all 4 M2M client configurations (none, read, write, read+write permissions)
  • Validated RBAC setup instructions produce correct permissions in JWT

Test Coverage:

  • Public endpoint (no auth)
  • Private endpoint (requires valid JWT)
  • Scoped endpoint (requires JWT with read:messages permission)

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

- Reorganized code into cmd/ and internal/ directories following Go best practices
- Split authentication logic into separate modules (claims, middleware, validator)
- Extracted configuration into dedicated config package
- Moved API handlers into separate handlers package
- Updated dependencies and build configurations
- Fixed issue #67: Added CORS support with WithValidateOnOptions(false) to allow OPTIONS preflight requests
- Fixed issue #60: Added comprehensive setup documentation for RBAC and M2M permissions
- Added screenshots showing Auth0 Dashboard configuration steps
- Updated README with detailed instructions to prevent empty permissions array

Closes #60
Closes #67
- Added GitHub Actions workflow for automated testing
- Uses ubuntu-20.04 runner with Go 1.24 and Node.js 20
- Clones latest test scripts from main branch
- Removed CircleCI configuration
- Removed semgrep workflow
- Maintains same test coverage with modern CI/CD platform
Copilot AI review requested due to automatic review settings January 19, 2026 13:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modernizes a Go-based Auth0 API authorization sample by refactoring the project structure, fixing CORS preflight issues, updating documentation for RBAC configuration, and migrating from CircleCI to GitHub Actions.

Changes:

  • Refactored code into cmd/ and internal/ directories following Go best practices with separated auth modules
  • Fixed CORS preflight validation by adding WithValidateOnOptions(false) to JWT middleware
  • Migrated CI/CD from CircleCI to GitHub Actions with updated test workflows
  • Updated dependencies from go-jwt-middleware v2 to v3

Reviewed changes

Copilot reviewed 19 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
LICENSE Updated copyright year to 2026
01-Authorization-RS256/go.mod Updated module path, Go version, and dependencies to v3
01-Authorization-RS256/Dockerfile Updated to Go 1.24 and changed port from 3010 to 8080
01-Authorization-RS256/cmd/server/main.go New application entry point with graceful shutdown
01-Authorization-RS256/internal/auth/*.go Extracted auth logic into separate modules (claims, middleware, validator)
01-Authorization-RS256/internal/config/auth.go Extracted configuration loading
01-Authorization-RS256/internal/handlers/api.go Extracted HTTP handlers
.github/workflows/test.yml New GitHub Actions workflow for automated testing
01-Authorization-RS256/exec.* Updated port from 3010 to 8080
assets/enable-rbac-settings.png Added screenshot for RBAC documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@developerkunal developerkunal enabled auto-merge (squash) January 19, 2026 15:05
- Created new 01-Quickstart-Go-API folder with refactored code using Go 1.24 and v3 SDK
- Reverted 01-Authorization-RS256 to original state for backward compatibility
- Updated GitHub Actions workflow to test both samples independently
- Fixed all module paths and import references in new folder
- Added CORS support with WithValidateOnOptions(false)
- Enhanced RBAC documentation with setup screenshots
- Updated .gitignore and dependabot.yml for dual-folder structure
- Removed 'Available Samples' section from main README
@developerkunal developerkunal merged commit 5fb58ba into master Jan 21, 2026
3 of 4 checks passed
@developerkunal developerkunal deleted the refactor-project-structure branch January 21, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CORS preflight request fails due to JWT validation in auth0-golang-api-samples Quickstart guide no longer valid

4 participants