Skip to content

feat(identity): 인증 API와 mock adapter 구성 #48 - #53

Open
kusuri12-09 wants to merge 23 commits into
developfrom
feat/48-identity-auth-api
Open

feat(identity): 인증 API와 mock adapter 구성 #48#53
kusuri12-09 wants to merge 23 commits into
developfrom
feat/48-identity-auth-api

Conversation

@kusuri12-09

@kusuri12-09 kusuri12-09 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • 회원가입, 로그인, 로그아웃, 토큰 갱신, 비밀번호 재설정 API를 구성했습니다.
  • AuthPort, 인증 command/result, Spring 비의존 AuthService를 구성했습니다.
  • JWT 생성·검증에 JJWT 0.13.0을 적용하고 Spring Security filter chain과 CSRF 정책을 추가했습니다.
  • jjwt-api, jjwt-impl, jjwt-jackson을 Bazel Maven 의존성으로 등록하고 기존 Nimbus 의존성을 제거했습니다.
  • AuthController는 JWT를 생성하지 않고 application 결과의 토큰을 HttpOnly cookie로 전달합니다.
  • CQRS account port, UserIdGenerator, transactional registration adapter, BCrypt password adapter를 연결했습니다.
  • JWT filter가 검증한 principal을 AuthenticatedUser로 SecurityContext에 저장합니다.
  • PR 기준 변경 파일은 54개입니다.

Related Issue

Scope

  • In scope:
    • /api/identity/v11/auth/signup
    • /api/identity/v11/auth/login
    • /api/identity/v11/auth/logout
    • /api/identity/v11/auth/token
    • /api/identity/v11/auth/password-reset
    • JJWT 기반 JWT 생성·검증 및 Spring Security 설정
    • 인증 mock adapter와 AuthService·JWT·filter 테스트
    • account CQRS port와 ID·비밀번호·회원가입 transaction adapter
  • Out of scope:
    • 실제 account/application JPA repository 및 DB migration
    • Redis·외부 인증 provider 연동
    • refresh token 저장소·rotation을 포함한 운영용 refresh 인증
    • application/account controller 및 지원서 기능

Implementation

  • AuthPort의 login/refresh 결과인 AuthTokenResult에 access·refresh JwtToken을 포함했습니다.
  • AuthServiceMockAuthPortAdapter가 주입된 JwtTokenGenerator로 토큰을 발급하며, controller는 cookie 설정과 응답 변환만 담당합니다.
  • JwtTokenGenerator는 JJWT의 Jwts.builder()로 HS256 토큰을 생성하고, JwtFilterverifyWith·parseSignedClaims로 서명·issuer·type·만료·principal 형식을 검증합니다.
  • 검증된 principal은 AuthenticatedUser로 변환하고 logout은 raw 문자열 principal을 받지 않습니다.
  • AccountRegistrationPort 구현체는 계정과 지원서 초기화를 하나의 @Transactional 경계로 묶습니다.
  • Clock Bean은 선행 PR #52에서 제공되며, 이 PR에서는 생성자 주입으로 사용합니다.
  • 최근 반영 커밋: 81ec990 refactor(identity): JWT 구현을 JJWT로 교체 #48

Testing

  • Unit test code added
  • Integration tests
  • Manual API verification
  • 검증한 내용:
    • git diff --check 통과
    • JJWT 0.13.0 의존성 resolve 성공
    • AuthController의 토큰 cookie·principal 경계 테스트
    • AuthService login·refresh·logout·signup·password-reset 행동 테스트
    • JWT generator/filter 및 공개 인증 endpoint 테스트
    • mock adapter token 검증 및 registration transaction 경계 테스트
  • 제한 사항:
    • 전체 Bazel build/test는 선행 PR #52의 공통 domain/result 타입이 현재 branch에 병합되지 않아 실행할 수 없습니다. 현재 build는 해당 타입 미해결 오류로 중단됩니다.

Deployment Notes

  • Feature flag: 없음
  • Migration required: 실제 DB schema migration은 포함하지 않음
  • Rollout considerations:
    • auth.jwt.secret은 최소 32바이트, auth.jwt.issuer는 배포 환경에서 주입해야 합니다.
    • HttpOnly·Secure cookie를 사용하므로 HTTPS와 CSRF token 전달 정책을 함께 확인해야 합니다.
    • 현재 refresh token 검증은 mock sentinel 기반이므로 운영 인증 연결 전에 서명·만료·rotation을 구현해야 합니다.
    • 선행 PR feat(identity): 공통 Identity API 기반 구성 #48 #52 병합 후 application/bootstrap 전체 build와 test를 재실행해야 합니다.

Checklist

  • Matches product/tech requirements
  • Backward compatibility considered
  • Local PR document updated
  • API success flow verified in a running environment
  • Real authentication adapter connected

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ready-for-review
🚫 Excluded labels (none allowed) (2)
  • wip
  • do-not-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 06b90cc5-f25c-4eed-96cd-9227ea1ee39f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

인증 포트와 서비스, JWT 생성·검증, 계정 영속성 어댑터, HTTP 인증 API와 Spring Security 구성이 추가되었습니다. 관련 Bazel 의존성과 모듈 테스트 스위트도 갱신되었습니다.

Changes

인증 애플리케이션과 JWT

Layer / File(s) Summary
인증 계약·서비스·토큰 생성
systems/identity/identity-application/...
인증 명령·결과와 포트를 정의하고, 회원가입·로그인·로그아웃·토큰 갱신·비밀번호 재설정, JWT 생성 및 민감정보 마스킹을 구현했습니다.
계정 영속성·보안 어댑터
systems/identity/identity-adapter-out/...
계정 조회·저장, 트랜잭션 등록, MySQL ID 생성, BCrypt 해시 구현과 테스트를 추가했습니다.
Spring Security와 JWT 필터
systems/identity/identity-bootstrap/...
JWT 설정, 보안 필터 체인, 토큰 검증 필터, 401·403 JSON 응답 처리와 관련 테스트를 추가했습니다.
인증 HTTP API
systems/identity/identity-adapter-in/...
회원가입·로그인·로그아웃·토큰 갱신·비밀번호 재설정 엔드포인트, 요청 DTO, 쿠키 처리와 컨트롤러 테스트를 추가했습니다.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant JwtFilter
  participant AuthController
  participant AuthService
  participant AccountRepository
  Client->>JwtFilter: JWT 포함 인증 요청
  JwtFilter->>JwtFilter: JWT 검증
  JwtFilter->>AuthController: 인증된 요청 전달
  AuthController->>AuthService: 인증 Command 전달
  AuthService->>AccountRepository: 계정 조회 또는 저장
  AuthService-->>AuthController: 인증 Result 반환
  AuthController-->>Client: ApiResponse와 토큰 쿠키 반환
Loading

Possibly related PRs

Suggested labels: feature, security, test, kotlin, bazel

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/48-identity-auth-api
  • 🛠️ cleanup stale imports
  • 🛠️ harden error messages
  • 🛠️ test clarity pass

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt`:
- Around line 107-120: Replace the fixed values in mockAccessTokenCookie and
mockRefreshTokenCookie with a token pair produced by the AuthPort login/refresh
results or the configured token generator. Ensure mock tokens are valid signed
HS256 JWTs and are unique per user/session, then preserve the existing cookie
security, path, and expiration settings.

In
`@systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt`:
- Around line 118-124: AuthControllerTest의 fake 구현에서 refreshToken과
resetPassword로 전달된 커맨드를 저장하도록 변경하고, 각 실제 컨트롤러 엔드포인트를 직접 호출하는 테스트를 추가하세요. refresh
cookie 전달, 커맨드 필드 매핑, 갱신 쿠키 발급 결과를 검증하는 결정적이고 의미 있는 단언을 작성하며, 항상 참인
assertNotNull 검증은 제거하세요.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt`:
- Around line 3-6: Override toString consistently for the sensitive data
classes: mask password in LoginCommand at
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt:3-6,
authorization in LogoutCommand at
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt:3-5,
refreshToken in RefreshTokenCommand at
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt:3-5,
and JwtToken.value in JwtTokenGenerator at
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt:112-117;
use one shared masking convention or utility and ensure no credential value
appears in the generated string.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt`:
- Around line 3-5: Update AuthController and LogoutCommand so the HTTP
Authorization header is parsed in the adapter layer and LogoutCommand receives
only the extracted token value; keep Bearer-prefix handling out of the
application layer and preserve the logout flow using the pure token.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt`:
- Around line 36-102: Replace the custom JWT construction in
JwtTokenGenerator.generateToken, including json, escapeJson, base64UrlEncode,
and hmacSha256, with the project’s standard JWT library used by JwtFilter. Build
the header and claims through that library, sign with the configured secret and
HS256, and return a JwtToken while preserving issuer, subject, type, issuedAt,
and expiresAt values.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt`:
- Around line 29-39: Replace the in-memory AtomicLong user ID generation in
AuthService.signup with the established persistent sequence, database-generated
ID, or durable ID-generation port, ensuring IDs remain unique across instances
and restarts. Remove the nextUserId counter usage while preserving the existing
Account.create flow.
- Around line 21-28: Remove the Spring-specific `@Service` annotation and its
org.springframework.stereotype.Service import from AuthService, leaving the
application service as a framework-independent class. Register and construct
AuthService in the bootstrap layer through a `@Bean` or adapter configuration
instead.
- Around line 53-54: AuthService의 계정 저장과 applicationDataPort.create 호출을 하나의 트랜잭션
또는 원자적 포트 연산으로 묶어, 애플리케이션 초기화 실패 시 계정 저장도 함께 롤백되도록 수정하세요.
accountRepository.save와 applicationDataPort.create가 동일한 트랜잭션 경계에서 실행되게 하며,
IdentityServiceSupport.findApplication의 기존 조회 동작은 변경하지 마세요.
- Around line 31-99: AuthService의 signup, login, resetPassword 동작을 검증하는 행동 테스트를
identity-application 테스트 영역에 추가하세요. 정상 회원가입과 중복 계정, 비활성 계정 로그인, 비밀번호 재설정 입력 및
사용자 검증 실패를 각각 검증하고, accountRepository.save 실패가 올바르게 전파되는지도 확인하세요. 기존 테스트 가이드와
테스트 더블 패턴을 따르며 관련 의존성 상호작용까지 검증하세요.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt`:
- Around line 11-22: Update AccountRepository.resolveAccount and the
AuthService.logout flow to use only the principal validated and injected by
JwtFilter through SecurityFilterChain, rather than parsing
LogoutCommand.authorization or accepting arbitrary Bearer user_XXX values.
Remove the token-to-userId interpretation from resolveAccount, and handle
mock-access-token/access-token behavior only through an explicit test or
mode-specific path.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt`:
- Around line 3-11: IdentityApplicationModuleTest의 SuiteClasses에 AuthService,
MockAuthPortAdapter, IdentityResultMapper, IdentityServiceSupport 관련 테스트를 추가해
identity-application의 프로덕션 로직이 모두 실행되도록 하세요. 해당 테스트가 존재하지 않거나 의도적으로 제외해야 한다면, 그
근거를 테스트 코드에 명시하고 JwtTokenGeneratorTest만 포함하는 현재 범위를 명확히 설명하세요.

In
`@systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt`:
- Around line 33-50: Update JwtFilter to bypass JWT validation and continue the
filter chain for public authentication endpoints, including the login, token,
password-reset, and signup paths. Keep the existing token resolution and
verification behavior unchanged for all other requests, including requests
without a token.

In
`@systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt`:
- Around line 57-58: Update the SecurityFilterChain configuration around csrf
and JwtFilter.resolveToken so cookie-based authentication is protected:
configure an appropriate CSRF token repository and asynchronous-request
protection, or remove the access_token cookie fallback so only
Authorization-header authentication remains. Do not rely on the existing cors
disablement as CSRF protection.

In
`@systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt`:
- Around line 18-35: Expand the tests in TestMain to cover the JWT filter and
security chain using a fixed Clock: verify valid, expired, tampered-signature,
malformed, and missing-token requests, including security context population and
401 versus filter-chain continuation behavior. Reuse the existing security
configuration and token-related symbols rather than limiting coverage to Java
Time mapping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 459e6080-113b-44e6-8695-eed6a8f02cb1

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff684b and 998b1a4.

📒 Files selected for processing (29)
  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/BUILD.bazel
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
📜 Review details
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{kt,go}

📄 CodeRabbit inference engine (Custom checks)

If production logic is changed in Kotlin or Go files, require corresponding test updates in the same subsystem unless the PR description explicitly justifies why tests are unnecessary

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
**/*-application/**/*.{java,kt,scala,groovy}

📄 CodeRabbit inference engine (Custom checks)

For files under *-application modules, flag direct dependency on infrastructure-specific framework classes unless justified

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
**/*.{java,kt,scala,groovy,go,js,ts,tsx,jsx,py,rb,rs,cpp,c,h,hpp,cs}

📄 CodeRabbit inference engine (Custom checks)

Flag TODO/FIXME comments introduced by this PR that do not include an issue reference in the form #123 or a full tracker key like PROJ-123

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
**/*.kt

⚙️ CodeRabbit configuration file

**/*.kt: Apply Kotlin Official Coding Conventions.

Formatting and structure:

  • Use 4 spaces for indentation; no tabs.
  • Keep files focused and readable; avoid horizontal alignment for spacing.
  • Place related declarations together and keep overloads adjacent.
  • Keep implementation member order stable and logical for readability.

Naming:

  • Package names are lowercase and do not use underscores.
  • Class/object names use UpperCamelCase.
  • Functions/properties/local variables use lowerCamelCase.
  • Constants use UPPER_SNAKE_CASE only for true constants.

API and null-safety:

  • Avoid platform type leakage in public APIs.
  • Use explicit types in public APIs when inference obscures meaning.
  • Prefer immutable values (val) over mutable values (var) unless mutation is required.
  • Flag nullable flows that can be replaced with safer modeling.

Imports and idioms:

  • Avoid wildcard imports unless justified by language/tooling conventions.
  • Prefer expression bodies for short, clear functions.
  • Prefer standard library idioms over custom utility wrappers when equivalent.

Architecture and tests:

  • Respect module boundaries (domain/application/adapter/bootstrap layering).
  • Highlight behavior-changing code that lacks corresponding unit/integration tests.
  • Ask for deterministic tests and meaningful assertions, not only happy-path checks.

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
**/{BUILD.bazel,*.bzl}

📄 CodeRabbit inference engine (Custom checks)

In BUILD.bazel and .bzl files, require buildifier-compatible formatting and stable target naming

Files:

  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-application/BUILD.bazel
**/BUILD.bazel

⚙️ CodeRabbit configuration file

**/BUILD.bazel: Apply Bazel BUILD style guidance.

Core rules:

  • BUILD formatting must match buildifier output.
  • Prefer DAMP BUILD files over over-abstracted DRY patterns.
  • Keep top-level layout clear: load() first, then package/default visibility, then targets.

Target definitions:

  • Keep deps explicit and close to each target's real direct dependencies.
  • Avoid recursive globs unless there is a clear, documented reason.
  • Avoid top-level list comprehensions for generating many targets.
  • Prefer literal labels and stable naming for readability and tooling compatibility.
  • Use boolean values (True/False), not numeric stand-ins.

Maintenance:

  • Flag duplicated target logic that should be moved into a macro.
  • Flag macro usage that hides important dependency or visibility decisions.

Files:

  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-application/BUILD.bazel
🪛 ast-grep (0.44.1)
systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt

[warning] 109-109: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: private const val ACCESS_TOKEN_COOKIE = "access_token"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)


[warning] 110-110: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: private const val ACCESS_TOKEN_TYPE = "access"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

🪛 detekt (1.23.8)
systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt

[warning] 86-86: The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.

(detekt.exceptions.TooGenericExceptionCaught)

🔇 Additional comments (18)
systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt (1)

33-49: LGTM!

Also applies to: 68-78, 92-105

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt (1)

1-9: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt (1)

1-12: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt (1)

1-14: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt (1)

28-84: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt (1)

10-42: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt (1)

3-13: LGTM!

systems/identity/identity-adapter-in/BUILD.bazel (1)

20-20: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt (2)

26-28: 🩺 Stability & Availability

Clock 빈 등록 여부를 확인하세요.

JwtFilterClock을 생성자 주입받지만 이 구성에는 해당 빈이 없습니다. 별도 빈이 없다면 컨텍스트 시작 시 주입에 실패합니다. Clock.systemUTC()를 반환하는 빈을 등록하거나 기존 정의를 확인하세요.


3-11: 📐 Maintainability & Code Quality

Jackson 3 전환은 해당되지 않습니다.

현재 Spring Boot 4 빌드도 jackson-module-kotlincom.fasterxml.jackson.module:jackson-module-kotlin:2.18.2로 선언하고 있어, 현재 com.fasterxml.jackson.*jacksonObjectMapper() import는 Jackson 2 API와 일치합니다.

			> Likely an incorrect or invalid review comment.
systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt (1)

5-9: 🔒 Security & Privacy

보안 설정값 검증이 이미 수행되고 있습니다.

JwtFilter에서 secret의 byte 길이가 32 바이트 미만이면 예외가 발생하므로 빈/짧은 HMAC 키 사용은 시작 시 제거됩니다. 같은 동작을 JwtProperties에 중복 추가할 필요는 없습니다.

			> Likely an incorrect or invalid review comment.
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt (1)

11-21: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt (1)

12-67: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt (1)

1-10: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt (1)

1-12: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt (1)

1-42: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt (1)

1-27: LGTM!

systems/identity/identity-application/BUILD.bazel (1)

14-21: LGTM!

@kusuri12-09

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@systems/identity/identity-adapter-out/deps.bzl`:
- Around line 1-6: KOTLIN_DEPS에서 spring-boot-starter-security 의존성을 제거하고,
BCryptPasswordEncoder 사용에 필요한 spring-security-crypto Maven 라벨로 교체하세요. 기존 JPA 및
애플리케이션·도메인 의존성은 유지하세요.

In
`@systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt`:
- Around line 7-12: 추가된 MysqlUserIdGenerator가 의존하는 identity_user_id_sequence
테이블과 초기 USER 행을 생성하는 migration을 추가하세요. 스키마는 sequence_name을 VARCHAR(32) 기본 키로,
next_id를 BIGINT NOT NULL로 정의하고, USER 키의 next_id 초기값을 설정해 첫 회원가입이 정상적으로 ID를 할당하도록
하세요.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt`:
- Around line 6-12: Implement safe toString() overrides for SignupCommand in
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt#L6-L12
and PasswordResetCommand in
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt#L5-L12,
masking password, loginId, name, phone, and birthdate while preserving only
non-sensitive fields such as signupType; ensure no credential or PII is emitted
in logs or exceptions.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt`:
- Around line 80-89: Remove the hardcoded "mock-refresh-token" validation from
AuthService.refreshToken and replace it with verification of the refresh JWT’s
signature, expiration, and token type. Extract the verified subject, load the
corresponding account, and issue tokens using that account’s user ID, role, and
status; preserve invalid and expired token errors and ensure refresh JWTs
generated by the existing token issuance flow are accepted.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt`:
- Around line 182-183: Update the default AccountRegistrationPort lambda in the
service helper to accept both register arguments, Account and Instant, while
preserving the existing account-returning behavior.
- Around line 3-6: AuthServiceTest.kt에서 사용하는 RefreshTokenCommand가 import되지
않았습니다. 기존 command import 목록에
hs.kr.entrydsm.identity.application.port.`in`.command.RefreshTokenCommand
import를 추가해 테스트가 컴파일되도록 수정하세요.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt`:
- Around line 10-21: Update signupValidationRejectsBlankRequiredFields to
capture the thrown IdentityDomainException instead of using the expected
annotation, then assert that its error code is INVALID_REQUEST_BODY. Preserve
the existing invalid SignupCommand setup and requireValidSignup invocation.

In
`@systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt`:
- Around line 50-52: Update tamperedAndMalformedTokensReturnUnauthorized so the
tampered case uses a well-formed JWT issued with a different secret key,
ensuring signature verification deterministically fails; keep the malformed
“not-a-jwt” case and existing unauthorized assertions unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 797ae6af-e298-46f9-94c8-c9d667115ca4

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff684b and 81ec990.

⛔ Files ignored due to path filters (1)
  • kotlin.MODULE.bazel is excluded by none and included by none
📒 Files selected for processing (53)
  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-adapter-in/deps.bzl
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-adapter-out/deps.bzl
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountCommandPersistenceAdapter.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountQueryPersistenceAdapter.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapter.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/security/BCryptPasswordHasher.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapterTest.kt
  • systems/identity/identity-application/BUILD.bazel
  • systems/identity/identity-application/deps.bzl
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-bootstrap/deps.bzl
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/IdentityApplicationConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/UserIdGeneratorConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt
📜 Review details
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{kt,go}

📄 CodeRabbit inference engine (Custom checks)

If production logic is changed in Kotlin or Go files, require corresponding test updates in the same subsystem unless the PR description explicitly justifies why tests are unnecessary

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountQueryPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/security/BCryptPasswordHasher.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountCommandPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapterTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/IdentityApplicationConfig.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/UserIdGeneratorConfig.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt
**/*-application/**/*.{java,kt,scala,groovy}

📄 CodeRabbit inference engine (Custom checks)

For files under *-application modules, flag direct dependency on infrastructure-specific framework classes unless justified

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt
**/*.{java,kt,scala,groovy,go,js,ts,tsx,jsx,py,rb,rs,cpp,c,h,hpp,cs}

📄 CodeRabbit inference engine (Custom checks)

Flag TODO/FIXME comments introduced by this PR that do not include an issue reference in the form #123 or a full tracker key like PROJ-123

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountQueryPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/security/BCryptPasswordHasher.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountCommandPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapterTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/IdentityApplicationConfig.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/UserIdGeneratorConfig.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt
**/*.kt

⚙️ CodeRabbit configuration file

**/*.kt: Apply Kotlin Official Coding Conventions.

Formatting and structure:

  • Use 4 spaces for indentation; no tabs.
  • Keep files focused and readable; avoid horizontal alignment for spacing.
  • Place related declarations together and keep overloads adjacent.
  • Keep implementation member order stable and logical for readability.

Naming:

  • Package names are lowercase and do not use underscores.
  • Class/object names use UpperCamelCase.
  • Functions/properties/local variables use lowerCamelCase.
  • Constants use UPPER_SNAKE_CASE only for true constants.

API and null-safety:

  • Avoid platform type leakage in public APIs.
  • Use explicit types in public APIs when inference obscures meaning.
  • Prefer immutable values (val) over mutable values (var) unless mutation is required.
  • Flag nullable flows that can be replaced with safer modeling.

Imports and idioms:

  • Avoid wildcard imports unless justified by language/tooling conventions.
  • Prefer expression bodies for short, clear functions.
  • Prefer standard library idioms over custom utility wrappers when equivalent.

Architecture and tests:

  • Respect module boundaries (domain/application/adapter/bootstrap layering).
  • Highlight behavior-changing code that lacks corresponding unit/integration tests.
  • Ask for deterministic tests and meaningful assertions, not only happy-path checks.

Files:

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountQueryPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/security/BCryptPasswordHasher.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountCommandPersistenceAdapter.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt
  • systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapterTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/IdentityApplicationConfig.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/UserIdGeneratorConfig.kt
  • systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt
  • systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt
  • systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt
  • systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt
  • systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt
  • systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt
**/{BUILD.bazel,*.bzl}

📄 CodeRabbit inference engine (Custom checks)

In BUILD.bazel and .bzl files, require buildifier-compatible formatting and stable target naming

Files:

  • systems/identity/identity-adapter-out/deps.bzl
  • systems/identity/identity-adapter-in/deps.bzl
  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-bootstrap/deps.bzl
  • systems/identity/identity-application/BUILD.bazel
  • systems/identity/identity-application/deps.bzl
**/*.bzl

⚙️ CodeRabbit configuration file

**/*.bzl: Apply Bazel Starlark (.bzl) style guidance.

Readability and docs:

  • Keep file/module docstrings and docstrings for public functions/macros.
  • Use descriptive parameter names and document attribute intent.

API design:

  • Macros should take a name argument and derive generated target names from it.
  • Prefer keyword arguments when calling macros for clarity and stability.
  • Keep macro side effects predictable and visible.

Encapsulation:

  • Use private visibility for helper targets created by macros unless explicitly public.
  • Avoid exposing internal implementation targets unintentionally.

Tooling:

  • Enforce buildifier formatting and lint compliance.

Files:

  • systems/identity/identity-adapter-out/deps.bzl
  • systems/identity/identity-adapter-in/deps.bzl
  • systems/identity/identity-bootstrap/deps.bzl
  • systems/identity/identity-application/deps.bzl
**/BUILD.bazel

⚙️ CodeRabbit configuration file

**/BUILD.bazel: Apply Bazel BUILD style guidance.

Core rules:

  • BUILD formatting must match buildifier output.
  • Prefer DAMP BUILD files over over-abstracted DRY patterns.
  • Keep top-level layout clear: load() first, then package/default visibility, then targets.

Target definitions:

  • Keep deps explicit and close to each target's real direct dependencies.
  • Avoid recursive globs unless there is a clear, documented reason.
  • Avoid top-level list comprehensions for generating many targets.
  • Prefer literal labels and stable naming for readability and tooling compatibility.
  • Use boolean values (True/False), not numeric stand-ins.

Maintenance:

  • Flag duplicated target logic that should be moved into a macro.
  • Flag macro usage that hides important dependency or visibility decisions.

Files:

  • systems/identity/identity-adapter-in/BUILD.bazel
  • systems/identity/identity-bootstrap/BUILD.bazel
  • systems/identity/identity-application/BUILD.bazel
🪛 ast-grep (0.44.1)
systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt

[warning] 83-83: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: const val SECRET = "01234567890123456789012345678901"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt

[warning] 35-35: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: const val SECRET = "01234567890123456789012345678901"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt

[warning] 112-112: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: private const val ACCESS_TOKEN_COOKIE = "access_token"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)


[warning] 113-113: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: private const val ACCESS_TOKEN_TYPE = "access"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt

[warning] 164-164: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: const val SECRET = "01234567890123456789012345678901"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt

[warning] 216-216: A credential is hard-coded by assigning a string literal to a password/secret/API-key variable. Secrets stored in source code can be leaked and abused by internal or external malicious actors. Remove the literal, rotate the exposed secret, and load it at runtime from an environment variable, a secure secret vault, or a Hardware Security Module (HSM).
Context: const val SECRET = "01234567890123456789012345678901"
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures

(hardcoded-password-string-literal-kotlin)

🪛 detekt (1.23.8)
systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt

[warning] 26-26: The caught exception is too generic. Prefer catching specific exceptions to the case that is currently handled.

(detekt.exceptions.TooGenericExceptionCaught)

🔇 Additional comments (50)
systems/identity/identity-adapter-in/BUILD.bazel (1)

14-21: LGTM!

systems/identity/identity-adapter-in/deps.bzl (1)

1-11: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthController.kt (1)

1-138: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/LoginRequest.kt (1)

1-9: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/PasswordResetRequest.kt (1)

1-12: LGTM!

systems/identity/identity-adapter-in/src/main/kotlin/hs/kr/entrydsm/identity/adapterin/web/dto/request/SignupRequest.kt (1)

1-14: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/TestMain.kt (1)

3-13: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/AuthControllerTest.kt (1)

1-210: LGTM!

systems/identity/identity-adapter-in/src/test/kotlin/hs/kr/entrydsm/identity/adapterin/web/exception/GlobalExceptionHandlerTest.kt (1)

1-42: LGTM!

systems/identity/identity-bootstrap/BUILD.bazel (1)

28-30: LGTM!

systems/identity/identity-bootstrap/deps.bzl (1)

3-3: LGTM!

Also applies to: 10-12

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/IdentityApplicationConfig.kt (1)

14-35: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/SecurityConfig.kt (2)

29-98: LGTM!


100-132: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/UserIdGeneratorConfig.kt (1)

9-14: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthenticationEntryPoint.kt (1)

14-33: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtAuthorizationDeniedHandler.kt (1)

14-33: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilter.kt (3)

22-64: LGTM!


66-108: LGTM!


110-123: LGTM!

systems/identity/identity-bootstrap/src/main/kotlin/hs/kr/entrydsm/identity/config/security/JwtProperties.kt (1)

5-9: LGTM!

systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/TestMain.kt (1)

21-47: LGTM!

systems/identity/identity-application/BUILD.bazel (1)

20-22: LGTM!

systems/identity/identity-application/deps.bzl (1)

3-5: LGTM!

Also applies to: 10-10

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapter.kt (1)

16-51: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/UserIdGenerator.kt (1)

3-5: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/AuthenticatedUser.kt (1)

3-5: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGenerator.kt (1)

17-65: LGTM!

Also applies to: 69-84

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapper.kt (1)

9-26: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/TestMain.kt (1)

3-19: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/mock/MockAuthPortAdapterTest.kt (1)

16-46: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/security/jwt/JwtTokenGeneratorTest.kt (1)

13-85: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityResultMapperTest.kt (1)

17-61: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/AuthPort.kt (1)

1-21: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LoginCommand.kt (1)

1-8: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/LogoutCommand.kt (1)

1-5: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/RefreshTokenCommand.kt (1)

1-7: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountCommandPort.kt (1)

1-8: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt (1)

1-9: LGTM!

systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt (1)

7-138: LGTM!

Also applies to: 149-180, 194-220

systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/TestMain.kt (1)

3-23: LGTM!

systems/identity/identity-adapter-out/src/test/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapterTest.kt (1)

1-52: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/result/AuthTokenResult.kt (1)

6-15: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountQueryPort.kt (1)

5-10: LGTM!

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt (1)

25-78: LGTM!

Also applies to: 92-121

systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupport.kt (1)

11-21: LGTM!

systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountCommandPersistenceAdapter.kt (1)

8-14: LGTM!

systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/AccountQueryPersistenceAdapter.kt (1)

8-17: LGTM!

systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/TransactionalAccountRegistrationAdapter.kt (1)

11-21: LGTM!

systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/security/BCryptPasswordHasher.kt (1)

8-17: LGTM!

Comment on lines +1 to +6
KOTLIN_DEPS = [
"@maven//:org_springframework_boot_spring_boot_starter_data_jpa",
"@maven//:org_springframework_boot_spring_boot_starter_security",
"//systems/identity/identity-application:main",
"//systems/identity/identity-domain:main",
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n --glob '*.bzl' \
  'org_springframework_boot_spring_boot_starter_security|org_springframework_security_spring_security_crypto' .

buildifier -mode=check systems/identity/identity-adapter-out/deps.bzl

Repository: EntryDSM/entrydsm-platform

Length of output: 572


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## relevant deps.bzl files"
for f in systems/identity/identity-bootstrap/deps.bzl systems/identity/identity-adapter-in/deps.bzl systems/identity/identity-adapter-out/deps.bzl; do
  echo "--- $f"
  cat -n "$f"
done

echo
echo "## BCryptPasswordEncoder usages"
rg -n "BCryptPasswordEncoder|new BCrypt|BCrypt" .

Repository: EntryDSM/entrydsm-platform

Length of output: 2756


🌐 Web query:

Maven Central spring-security-crypto dependency coordinate org.springframework.security spring-security-crypto

💡 Result:

The dependency coordinate for Spring Security Crypto on Maven Central is: Group ID: org.springframework.security Artifact ID: spring-security-crypto For Maven projects, you can include it in your pom.xml file as follows: org.springframework.security spring-security-crypto 7.0.5 For Gradle projects, you can add it to your build.gradle file: implementation("org.springframework.security:spring-security-crypto:7.0.5") This module provides support for symmetric encryption, key generation, and password encoding and is designed to have no dependencies on other Spring Security or Spring Framework code [1]. Version 7.0.5 is a recent release available on Maven Central [2][3].

Citations:


Security starter 대신 crypto 라이브러리로 의존성을 좁히세요.

identity-adapter-outBCryptPasswordEncoder만 직접 참조하는데, spring-boot-starter-security를 가져와 불필요한 Spring Security 트랜지티브 의존성을 생성합니다. @maven//:org_springframework_boot_spring_boot_starter_security 대신 org.springframework.security:spring-security-crypto Maven 라벨을 선언하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@systems/identity/identity-adapter-out/deps.bzl` around lines 1 - 6,
KOTLIN_DEPS에서 spring-boot-starter-security 의존성을 제거하고, BCryptPasswordEncoder 사용에
필요한 spring-security-crypto Maven 라벨로 교체하세요. 기존 JPA 및 애플리케이션·도메인 의존성은 유지하세요.

Source: Path instructions

Comment on lines +7 to +12
/**
* Allocates user IDs from a durable MySQL counter row.
*
* The counter row must be created by the database schema:
* `identity_user_id_sequence(sequence_name VARCHAR(32) PRIMARY KEY, next_id BIGINT NOT NULL)`.
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

시퀀스 테이블과 초기 행을 생성하는 migration을 함께 추가하세요.

이 구현은 identity_user_id_sequenceUSER 행이 존재한다고 가정합니다. PR 범위에서 migration이 제외되어 현재 상태로는 첫 회원가입이 SQL 오류로 실패합니다. 테이블 생성과 초기 next_id 삽입 migration을 포함하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-adapter-out/src/main/kotlin/hs/kr/entrydsm/identity/adapterout/persistence/MysqlUserIdGenerator.kt`
around lines 7 - 12, 추가된 MysqlUserIdGenerator가 의존하는 identity_user_id_sequence
테이블과 초기 USER 행을 생성하는 migration을 추가하세요. 스키마는 sequence_name을 VARCHAR(32) 기본 키로,
next_id를 BIGINT NOT NULL로 정의하고, USER 키의 next_id 초기값을 설정해 첫 회원가입이 정상적으로 ID를 할당하도록
하세요.

Comment on lines +6 to +12
data class SignupCommand(
val password: String,
val name: String,
val phone: String,
val birthdate: LocalDate,
val signupType: SignupType,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

인증 커맨드의 toString()에서 자격증명과 PII를 모두 마스킹하세요.

SignupCommand는 기본 toString()으로 password, 이름, 전화번호, 생년월일을 노출하고, PasswordResetCommand도 loginId·이름·생년월일을 노출합니다. 로그나 예외에 포함되면 자격증명 및 개인정보가 유출됩니다.

  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt#L6-L12: password와 가입자 PII를 마스킹하는 toString()을 구현하세요.
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt#L5-L12: 현재 노출되는 loginId, name, birthdate도 마스킹하세요.
📍 Affects 2 files
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt#L6-L12 (this comment)
  • systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt#L5-L12
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt`
around lines 6 - 12, Implement safe toString() overrides for SignupCommand in
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/SignupCommand.kt#L6-L12
and PasswordResetCommand in
systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/in/command/PasswordResetCommand.kt#L5-L12,
masking password, loginId, name, phone, and birthdate while preserving only
non-sensitive fields such as signupType; ensure no credential or PII is emitted
in logs or exceptions.

Comment on lines +80 to +89
override fun refreshToken(command: RefreshTokenCommand): AuthTokenResult {
val token = command.refreshToken?.takeIf { it.isNotBlank() }
?: throw IdentityDomainException(ErrorCode.INVALID_REFRESH_TOKEN)
if (token.startsWith("expired-")) {
throw IdentityDomainException(ErrorCode.EXPIRED_REFRESH_TOKEN)
}
if (token != "mock-refresh-token") {
throw IdentityDomainException(ErrorCode.INVALID_REFRESH_TOKEN)
}
return issueTokens(userId = 123L, role = "STUDENT", status = AccountStatus.ACTIVE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift

운영 경로의 고정 mock refresh token 검증을 제거하세요.

Line 86의 고정 값은 누구나 userId=123, role=STUDENT 토큰을 발급받게 하며, 동일 파일 Line 115-116에서 발급한 실제 refresh JWT는 거절됩니다. 서명·만료·토큰 유형을 검증한 뒤 subject의 계정을 조회하여 토큰을 재발급하도록 바꾸세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt`
around lines 80 - 89, Remove the hardcoded "mock-refresh-token" validation from
AuthService.refreshToken and replace it with verification of the refresh JWT’s
signature, expiration, and token type. Extract the verified subject, load the
corresponding account, and issue tokens using that account’s user ID, role, and
status; preserve invalid and expired token errors and ensure refresh JWTs
generated by the existing token issuance flow are accepted.

Comment on lines +3 to +6
import hs.kr.entrydsm.identity.application.port.`in`.command.LoginCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.LogoutCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.PasswordResetCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.SignupCommand

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt"

echo "== file exists =="
test -f "$FILE" && echo yes || echo no

echo "== imports and relevant usages =="
rg -n "import .*Command|RefreshTokenCommand|RefreshToken|refreshToken|Line 142|142" "$FILE" || true
sed -n '1,30p;130,150p' "$FILE"

echo "== source declaration candidates =="
fd -i "RefreshTokenCommand.kt|RefreshToken" . | sed -n '1,80p'

echo "== precise usage/import probe =="
python3 - <<'PY'
from pathlib import Path
p = Path("systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt")
src = p.read_text()
lines = src.splitlines()
need_import = set()
for i,l in enumerate(lines,1):
    if "RefreshTokenCommand" in l:
        print(f"{i}:{l.strip()}")
imports = {line.strip() for line in lines if line.startswith("import ")}
for name in ("hs.kr.entrydsm.identity.application.port.`in`.command.RefreshTokenCommand", "RefreshTokenCommand"):
    print(f"{name} present in imports:", any(name in imp for imp in imports))
PY

Repository: EntryDSM/entrydsm-platform

Length of output: 3800


RefreshTokenCommand import를 추가하세요.

AuthServiceTest.kt에서 142, 151행에 RefreshTokenCommand를 사용하고 있지만 import가 없어 테스트 파일이 컴파일되지 않습니다.

수정 예시
 import hs.kr.entrydsm.identity.application.port.`in`.command.PasswordResetCommand
+import hs.kr.entrydsm.identity.application.port.`in`.command.RefreshTokenCommand
 import hs.kr.entrydsm.identity.application.port.`in`.command.SignupCommand
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import hs.kr.entrydsm.identity.application.port.`in`.command.LoginCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.LogoutCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.PasswordResetCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.SignupCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.LoginCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.LogoutCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.PasswordResetCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.RefreshTokenCommand
import hs.kr.entrydsm.identity.application.port.`in`.command.SignupCommand
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt`
around lines 3 - 6, AuthServiceTest.kt에서 사용하는 RefreshTokenCommand가 import되지
않았습니다. 기존 command import 목록에
hs.kr.entrydsm.identity.application.port.`in`.command.RefreshTokenCommand
import를 추가해 테스트가 컴파일되도록 수정하세요.

Comment on lines +182 to +183
private fun service(
registration: AccountRegistrationPort = AccountRegistrationPort { account -> account },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
git ls-files | rg 'AuthServiceTest\.kt|AccountRegistrationPort|AuthService'

echo "== inspect test around register/service helper =="
if [ -f systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt ]; then
  sed -n '150,210p' systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt | cat -n
fi

echo "== search AccountRegistrationPort definitions/usages =="
rg -n "interface AccountRegistrationPort|class AccountRegistrationPort|typealias AccountRegistrationPort|AccountRegistrationPort" -S .

Repository: EntryDSM/entrydsm-platform

Length of output: 5370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
git ls-files | rg 'AuthServiceTest\.kt|AccountRegistrationPort|AuthService'

echo "== inspect test around register/service helper =="
if [ -f systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt ];则
  sed -n '150,210p' systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt | cat -n
fi

echo "== search AccountRegistrationPort definitions/usages =="
rg -n "interface AccountRegistrationPort|class AccountRegistrationPort|typealias AccountRegistrationPort|AccountRegistrationPort" -S .

Repository: EntryDSM/entrydsm-platform

Length of output: 644


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

for p in [
    "systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt",
    "systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/service/AuthService.kt",
    "systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt",
]:
    if not Path(p).exists():
        print(f"MISSING: {p}")
        continue
    text = Path(p).read_text()
    print(f"\n== {p} ==")
    for i, line in enumerate(text.splitlines(), start=1):
        if any(tok in line for tok in ["interface AccountRegistrationPort", "AccountRegistrationPort {", "register(", "fun service(", "AccountRegistrationPort { account -> account", "AccountRegistrationPort { account, _ ->"]):
            print(f"{i:4}: {line}")

PORT = Path("systems/identity/identity-application/src/main/kotlin/hs/kr/entrydsm/identity/application/port/out/AccountRegistrationPort.kt").read_text()
MATCH = re.search(r"fun interface AccountRegistrationPort\s*\{([^}]*)\}", PORT, re.S)
if MATCH:
    body = MATCH.group(1)
    print(f"\n== extracted function interface body ==")
    print(body.strip())
    print("parameter_count_estimate:", body.count(","))
PY

Repository: EntryDSM/entrydsm-platform

Length of output: 1057


기본 AccountRegistrationPort 람다의 인자를 두 개로 맞추세요.

registerAccount, Instant 두 인자를 받기 때문에 기본값 람다도 두 번째 인자를 표현해야 컴파일됩니다.

수정 예시
-        registration: AccountRegistrationPort = AccountRegistrationPort { account -> account },
+        registration: AccountRegistrationPort = AccountRegistrationPort { account, _ -> account },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private fun service(
registration: AccountRegistrationPort = AccountRegistrationPort { account -> account },
private fun service(
registration: AccountRegistrationPort = AccountRegistrationPort { account, _ -> account },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/AuthServiceTest.kt`
around lines 182 - 183, Update the default AccountRegistrationPort lambda in the
service helper to accept both register arguments, Account and Instant, while
preserving the existing account-returning behavior.

Comment on lines +10 to +21
@Test(expected = IdentityDomainException::class)
fun signupValidationRejectsBlankRequiredFields() {
requireValidSignup(
SignupCommand(
password = "",
name = "홍길동",
phone = "01012345678",
birthdate = LocalDate.of(2009, 3, 15),
signupType = SignupType.SELF,
)
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

예외 유형뿐 아니라 오류 코드도 검증하세요.

현재는 어떤 IdentityDomainException이 발생해도 통과합니다. 예외를 캡처하고 INVALID_REQUEST_BODY를 assertion하여 입력 검증 계약을 고정하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-application/src/test/kotlin/hs/kr/entrydsm/identity/application/service/IdentityServiceSupportTest.kt`
around lines 10 - 21, Update signupValidationRejectsBlankRequiredFields to
capture the thrown IdentityDomainException instead of using the expected
annotation, then assert that its error code is INVALID_REQUEST_BODY. Preserve
the existing invalid SignupCommand setup and requireValidSignup invocation.

Source: Path instructions

Comment on lines +50 to +52
fun tamperedAndMalformedTokensReturnUnauthorized() {
val tamperedResult = runFilter(accessToken().dropLast(1) + "x")
val malformedResult = runFilter("not-a-jwt")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

서명 불일치를 결정적으로 만들도록 변경하세요.

마지막 Base64URL 문자만 바꾸면 패딩 비트만 달라져 동일한 서명 바이트로 해석될 수 있습니다. 다른 비밀키로 발급한 정상 형식 JWT를 사용해 서명 검증 실패를 보장하세요.

수정 예시
-        val tamperedResult = runFilter(accessToken().dropLast(1) + "x")
+        val tamperedResult = runFilter(
+            JwtTokenGenerator(
+                secret = "abcdefghijklmnopqrstuvwxyz123456",
+                issuer = ISSUER,
+                clock = Clock.fixed(FIXED_NOW, UTC),
+            ).generateAccessToken("user_123").value
+        )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fun tamperedAndMalformedTokensReturnUnauthorized() {
val tamperedResult = runFilter(accessToken().dropLast(1) + "x")
val malformedResult = runFilter("not-a-jwt")
fun tamperedAndMalformedTokensReturnUnauthorized() {
val tamperedResult = runFilter(
JwtTokenGenerator(
secret = "abcdefghijklmnopqrstuvwxyz123456",
issuer = ISSUER,
clock = Clock.fixed(FIXED_NOW, UTC),
).generateAccessToken("user_123").value
)
val malformedResult = runFilter("not-a-jwt")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@systems/identity/identity-bootstrap/src/test/kotlin/hs/kr/entrydsm/identity/config/security/JwtFilterTest.kt`
around lines 50 - 52, Update tamperedAndMalformedTokensReturnUnauthorized so the
tampered case uses a well-formed JWT issued with a different secret key,
ensuring signature verification deterministically fails; keep the malformed
“not-a-jwt” case and existing unauthorized assertions unchanged.

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.

1 participant