Skip to content

Feat/#1#2

Open
jhlarry1109 wants to merge 15 commits into
mainfrom
feat/#1
Open

Feat/#1#2
jhlarry1109 wants to merge 15 commits into
mainfrom
feat/#1

Conversation

@jhlarry1109
Copy link
Copy Markdown

#️⃣ 연관된 이슈

#1


📝 작업 내용

User 서비스


💬 리뷰 요청 사항 (선택)

patch의 상태코드가 이상합니다


Comment thread src/main/java/com/example/user/global/security/UserPrincipal.java
Comment thread src/main/java/com/example/user/global/util/HttpUtil.java Outdated
Comment thread src/main/java/com/example/user/global/util/ResponseUtil.java
Comment thread Dockerfile
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

Adds a new Spring Boot “User” service implementing basic user CRUD plus internal authentication endpoints, backed by PostgreSQL/JPA and secured with a JWT filter.

Changes:

  • Implemented User domain (entity/role), repository, services, and REST controllers for signup + “me” profile/update/delete.
  • Added internal auth endpoints (email/password + Google OAuth payload handling) and JWT-based Security configuration.
  • Added runtime/build configuration (application config, Dockerfile, and Gradle dependencies).

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/main/resources/application.yml Adds server, datasource, JPA, and JWT configuration
src/main/resources/application.yaml Removes duplicate/old minimal Spring config
src/main/java/com/example/user/service/UserService.java User signup/profile/update/delete service logic
src/main/java/com/example/user/service/InternalUserService.java Internal authentication logic (password + Google)
src/main/java/com/example/user/repository/UserRepository.java JPA repository and lookup helpers
src/main/java/com/example/user/global/util/ResponseUtil.java API response wrapper helper
src/main/java/com/example/user/global/security/UserPrincipal.java Custom principal stored in SecurityContext
src/main/java/com/example/user/global/security/JwtProvider.java JWT parsing/validation helpers
src/main/java/com/example/user/global/security/JwtFilter.java Extracts JWT from Authorization header and authenticates request
src/main/java/com/example/user/global/dto/ApiResponse.java Generic API response record
src/main/java/com/example/user/global/config/SecurityConfig.java Configures stateless security + JWT filter
src/main/java/com/example/user/global/config/PasswordEncoderConfig.java BCrypt PasswordEncoder bean
src/main/java/com/example/user/entity/User.java User entity with soft-delete and factory methods
src/main/java/com/example/user/entity/Role.java Role enum
src/main/java/com/example/user/dto/response/UserSearchResponse.java “My profile” response DTO
src/main/java/com/example/user/dto/response/UserAuthResponse.java Auth response DTO
src/main/java/com/example/user/dto/response/SignUpResponse.java Signup response DTO
src/main/java/com/example/user/dto/request/UserUpdateRequest.java Patch/update request DTO
src/main/java/com/example/user/dto/request/UserGoogleOauthRequest.java Google OAuth request DTO
src/main/java/com/example/user/dto/request/SignUpRequest.java Signup request DTO with validation
src/main/java/com/example/user/dto/request/SignInRequest.java Sign-in request DTO
src/main/java/com/example/user/controller/UserController.java Public user endpoints (/users/**)
src/main/java/com/example/user/controller/InternalUserController.java Internal auth endpoints (/internal/users/**)
Dockerfile Container build/run flow for the service
build.gradle Adds web/validation/security/jjwt dependencies

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

Comment on lines +29 to +33
.authorizeHttpRequests(auth -> auth
.requestMatchers("/users/signup").permitAll()
.requestMatchers("/users/me").authenticated()
.anyRequest().permitAll()
)
Comment on lines +23 to +26
public SignUpResponse signup(SignUpRequest request) {
if (userRepository.existsByEmail(request.email())) {
throw new IllegalArgumentException("이미 존재하는 이메일");
}
Comment on lines +23 to +36
public SignUpResponse signup(SignUpRequest request) {
if (userRepository.existsByEmail(request.email())) {
throw new IllegalArgumentException("이미 존재하는 이메일");
}

String encodedPassword = passwordEncoder.encode(request.password());

User user = User.create(
request.email(),
encodedPassword,
request.name()
);
userRepository.save(user);

Comment on lines +21 to +35
@PostMapping("/authenticate")
public ResponseEntity<UserAuthResponse> authenticate(
@RequestBody SignInRequest request
) {
UserAuthResponse response = internalUserService.authenticate(request);

return ResponseEntity.ok(response);
}

@PostMapping("/oauth/google")
public ResponseEntity<UserAuthResponse> authenticateGoogle(
@RequestBody UserGoogleOauthRequest request
) {
return ResponseEntity.ok(internalUserService.authenticateGoogle(request));
}
Comment on lines +30 to +35
@PostMapping("/oauth/google")
public ResponseEntity<UserAuthResponse> authenticateGoogle(
@RequestBody UserGoogleOauthRequest request
) {
return ResponseEntity.ok(internalUserService.authenticateGoogle(request));
}
Comment on lines +19 to +20
jwt:
secret: "${JWT_SECRET:momentlit-user-service-jwt-secret-key-for-local-test-1234567890}"
Comment thread Dockerfile
Comment on lines +6 to +10
RUN ./gradlew dependencies --no-daemon

COPY src ./src
RUN ./gradlew bootJar -x test --no-daemon

Comment on lines +2 to +7

public record SignInRequest(
String email,
String password
) {
}
Comment on lines +3 to +19
import com.fasterxml.jackson.annotation.JsonProperty;

public record UserGoogleOauthRequest(
@JsonProperty("provider_id")
String providerId,

String email,

@JsonProperty("email_verified")
Boolean emailVerified,

String name,

@JsonProperty("image_url")
String imageUrl
) {
}
Comment on lines +16 to +18
import java.io.IOException;
import java.util.Collections;
import java.util.List;
Hyun731
Hyun731 previously approved these changes May 28, 2026
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.

3 participants