Analytics 서비스 및 보안 기능 업데이트

- Analytics 서비스 구현 추가 (API, 소스 코드)
- Event 서비스 소스 코드 추가
- 보안 관련 공통 컴포넌트 업데이트 (JWT, UserPrincipal, ErrorCode)
- API 컨벤션 및 명세서 업데이트
- 데이터베이스 SQL 스크립트 추가
- 백엔드 개발 문서 및 테스트 가이드 추가
- Kafka 메시지 체크 도구 추가

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
doyeon
2025-10-27 16:11:00 +09:00
parent 003b3843cc
commit b198c46d06
105 changed files with 9189 additions and 20 deletions
@@ -5,8 +5,10 @@ import com.kt.event.common.security.JwtTokenProvider;
import com.kt.event.user.dto.request.LoginRequest;
import com.kt.event.user.dto.response.LoginResponse;
import com.kt.event.user.dto.response.LogoutResponse;
import com.kt.event.user.entity.Store;
import com.kt.event.user.entity.User;
import com.kt.event.user.exception.UserErrorCode;
import com.kt.event.user.repository.StoreRepository;
import com.kt.event.user.repository.UserRepository;
import com.kt.event.user.service.AuthenticationService;
import com.kt.event.user.service.UserService;
@@ -34,6 +36,7 @@ import java.util.concurrent.TimeUnit;
public class AuthenticationServiceImpl implements AuthenticationService {
private final UserRepository userRepository;
private final StoreRepository storeRepository;
private final PasswordEncoder passwordEncoder;
private final JwtTokenProvider jwtTokenProvider;
private final UserService userService;
@@ -42,10 +45,12 @@ public class AuthenticationServiceImpl implements AuthenticationService {
private RedisTemplate<String, Object> redisTemplate;
public AuthenticationServiceImpl(UserRepository userRepository,
StoreRepository storeRepository,
PasswordEncoder passwordEncoder,
JwtTokenProvider jwtTokenProvider,
UserService userService) {
this.userRepository = userRepository;
this.storeRepository = storeRepository;
this.passwordEncoder = passwordEncoder;
this.jwtTokenProvider = jwtTokenProvider;
this.userService = userService;
@@ -68,21 +73,26 @@ public class AuthenticationServiceImpl implements AuthenticationService {
throw new BusinessException(UserErrorCode.AUTH_FAILED.getErrorCode());
}
// 3. JWT 토큰 생성
// 3. 매장 정보 조회
Store store = storeRepository.findByUserId(user.getId()).orElse(null);
Long storeId = store != null ? store.getId() : null;
// 4. JWT 토큰 생성
String token = jwtTokenProvider.createAccessToken(
user.getId(),
storeId,
user.getEmail(),
user.getName(),
List.of(user.getRole().name())
);
// 4. Redis 세션 저장 (TTL 7일)
// 5. Redis 세션 저장 (TTL 7일)
saveSession(token, user.getId(), user.getRole().name());
// 5. 최종 로그인 시각 업데이트 (비동기)
// 6. 최종 로그인 시각 업데이트 (비동기)
userService.updateLastLoginAt(user.getId());
// 6. 응답 반환
// 7. 응답 반환
return LoginResponse.builder()
.token(token)
.userId(user.getId())
@@ -103,6 +103,7 @@ public class UserServiceImpl implements UserService {
// 6. JWT 토큰 생성
String token = jwtTokenProvider.createAccessToken(
savedUser.getId(),
savedStore.getId(),
savedUser.getEmail(),
savedUser.getName(),
List.of(savedUser.getRole().name())