feat(identity): setup base entities, DTOs, and JWT security config#2
Draft
feat(identity): setup base entities, DTOs, and JWT security config#2
Conversation
identity/src/main/kotlin/org/spendoo/identity/dto/response/AuthResponse.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/request/RegisterRequest.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/entity/EmailVerification.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/security/CustomUserDetailsService.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR establishes the foundational authentication and identity management infrastructure for the Spendoo application. It introduces JWT-based stateless authentication, user management entities with email verification support, and Spring Security configuration. The implementation uses Spring Boot 4.0.1 with Kotlin, PostgreSQL for persistence, and JJWT for token management.
Changes:
- Added
UserandEmailVerificationJPA entities with PostgreSQL schema definitions - Implemented Spring Security configuration with JWT-based stateless authentication and custom user details service
- Created authentication DTOs (RegisterRequest, LoginRequest, AuthResponse, etc.) and user mapper extension functions
- Configured application properties for database, JWT, and email services
- Added required dependencies including Spring Security, JPA, PostgreSQL driver, and JJWT libraries
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 28 comments.
Show a summary per file
| File | Description |
|---|---|
| identity/src/main/kotlin/org/spendoo/identity/entity/User.kt | Defines the User entity with email, password, profile fields, and email verification relationship |
| identity/src/main/kotlin/org/spendoo/identity/entity/EmailVerification.kt | Defines the EmailVerification entity for OTP-based email verification with expiry logic |
| identity/src/main/kotlin/org/spendoo/identity/security/SecurityConfig.kt | Configures Spring Security with stateless JWT authentication and public endpoints |
| identity/src/main/kotlin/org/spendoo/identity/security/JwtUtil.kt | Implements JWT token generation, validation, and username extraction |
| identity/src/main/kotlin/org/spendoo/identity/security/JwtFilter.kt | Filter to intercept requests and validate JWT tokens in Authorization headers |
| identity/src/main/kotlin/org/spendoo/identity/security/CustomUserDetailsService.kt | Bridges the User entity with Spring Security's authentication framework |
| identity/src/main/kotlin/org/spendoo/identity/mapper/UserMapper.kt | Extension function to convert RegisterRequest DTO to User entity |
| identity/src/main/kotlin/org/spendoo/identity/dto/*.kt | Request/response DTOs for authentication operations (register, login, OTP verification, password reset) |
| identity/build.gradle.kts | Added dependencies for Spring Security, JPA, JJWT, validation, and email |
| app/build.gradle.kts | Added JPA and PostgreSQL dependencies to the main application module |
| app/src/main/kotlin/org/spendoo/app/SpendooApplication.kt | Enabled JPA repositories and entity scanning for multi-module architecture |
| app/src/main/resources/application.properties | Configured database connection, JPA settings, email service, and JWT secret |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
identity/src/main/kotlin/org/spendoo/identity/security/CustomUserDetailsService.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/security/CustomUserDetailsService.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/security/JwtUtil.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/RegisterRequest.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/ForgotPasswordRequest.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/request/ResetPasswordRequest.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/security/SecurityConfig.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/LoginRequest.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/ResetPasswordRequest.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/dto/request/ResetPasswordRequest.kt
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/entity/EmailVerification.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/repository/UserRepository.kt
Outdated
Show resolved
Hide resolved
identity/src/main/kotlin/org/spendoo/identity/controller/AuthController.kt
Outdated
Show resolved
Hide resolved
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.
User,EmailVerificationandRefreshTokenentities with schema definitions.UserMapperextension functions.JwtUtilandJwtFilterfor token generation and validation.CustomUserDetailsServiceto link DB with Spring Security.