mirror of
https://github.com/Fishwaldo/auth2.git
synced 2025-06-03 12:21:22 +00:00
No description
This commit implements a comprehensive OAuth2 authentication framework that provides: **Core Components:** - Generic OAuth2 provider with authorization code and direct token flows - Comprehensive configuration system with pre-configured provider settings - State manager for CSRF protection with secure parameter handling - Token manager for secure storage, refresh detection, and expiration tracking - Flow handler for authorization URLs, code exchange, and user info retrieval **Security Features:** - CSRF protection via cryptographically secure state parameters - Automatic token refresh with configurable thresholds - One-time use state parameter validation - Secure token and user profile storage using StateStore interface - Proper error handling without exposing sensitive information **Pre-configured Providers:** - Google OAuth2 with OpenID Connect support - GitHub OAuth2 with user profile mapping - Microsoft OAuth2 with Graph API integration - Facebook OAuth2 with profile picture handling **Developer Experience:** - Factory pattern for easy provider instantiation - Quick helper functions: QuickGoogle(), QuickGitHub(), QuickMicrosoft(), QuickFacebook() - Flexible configuration supporting maps, structs, and tagged configurations - Extensible profile mapping system for custom providers - Comprehensive error types with descriptive messages **Testing & Documentation:** - 72.8% test coverage with comprehensive unit tests - Mock-based testing for all major components - Detailed README with usage examples and security considerations - Table-driven tests covering success and failure scenarios **Files Added:** - pkg/auth/providers/oauth2/provider.go - Main OAuth2 provider implementation - pkg/auth/providers/oauth2/config.go - Configuration and provider presets - pkg/auth/providers/oauth2/flow.go - OAuth2 flow handlers - pkg/auth/providers/oauth2/state.go - CSRF state parameter management - pkg/auth/providers/oauth2/token.go - Token storage and management - pkg/auth/providers/oauth2/profile.go - User profile mapping utilities - pkg/auth/providers/oauth2/factory.go - Provider factory with quick helpers - pkg/auth/providers/oauth2/types.go - OAuth2 type definitions - pkg/auth/providers/oauth2/errors.go - OAuth2-specific errors - pkg/auth/providers/oauth2/README.md - Comprehensive documentation - Complete test suite for all components This implementation provides the foundation for Phase 2.5 OAuth2 provider implementations while maintaining the plugin architecture principles and security best practices. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
---|---|---|
.github | ||
docs | ||
internal/errors | ||
pkg | ||
.gitignore | ||
CLAUDE.md | ||
go.mod | ||
go.sum |
Auth2 Documentation
Welcome to the Auth2 documentation. This guide will help you understand how to use and extend the Auth2 authentication library.
Table of Contents
-
- Installation
- Basic Setup
- Configuration Options
-
- Architecture Overview
- Authentication Flow
- Session Management
-
- Development Guidelines
- Testing
- Pull Request Process