Conversation
Implement complete authentication system with JWT, user/role management, and Spring Security configuration. ## Components Implemented ### Entities - User entity with full fields (email, password, firstName, lastName, phone, userType, active) - Role entity with RoleName enum (6 roles: USER, MEMBER, STUDENT, INSTRUCTOR, ADMIN, SUPER_ADMIN) - Many-to-many relationship between User and Role ### Security & Authentication - JWT stateless authentication with access tokens (1h) and refresh tokens (7 days) - JwtTokenProvider for token generation and validation - JwtAuthenticationFilter for request interception - UserDetailsServiceImpl for Spring Security integration - SecurityConfig with CORS, BCrypt (strength 12), and endpoint protection - JwtConfig for externalized JWT configuration ### API Endpoints - POST /api/v1/auth/register - Public user registration - POST /api/v1/auth/login - Public login - GET /api/v1/auth/me - Get current user (authenticated) ### DTOs - LoginRequest, RegisterRequest with Bean Validation - JwtResponse with tokens and user info - UserResponse without sensitive data ### Services - AuthService for registration, login, token generation, and user retrieval ### Database - Flyway migrations V1 (schema) and V2 (seed roles) - Tables: users, roles, user_roles - Indexes for optimization ### Exception Handling - GlobalExceptionHandler for centralized error handling - Custom exceptions: UserNotFoundException, EmailAlreadyExistsException - Proper HTTP status codes and error responses ## Technical Details - Package structure: uy.supap - Password validation: min 8 chars, uppercase, lowercase, number, special char - Email and phone validation - CORS configured for localhost:3000 and supap.uy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1: Core Backend Setup
This PR implements the complete authentication system with JWT, user/role management, and Spring Security configuration.
🎯 Components Implemented
Entities:
Authentication & Security:
API Endpoints:
Database:
📊 Files Changed
22 files added:
✅ Checklist
📝 Testing
After merge, test:
Ready for review and merge to main ✅