diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/Admin.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/Admin.kt deleted file mode 100644 index d2968df..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/Admin.kt +++ /dev/null @@ -1,15 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.domain - -import hs.kr.entrydsm.user.global.entity.BaseUUIDEntity -import java.util.UUID -import jakarta.persistence.Column -import jakarta.persistence.Entity - -@Entity(name = "tbl_admin") -class Admin( - id: UUID?, - @Column(name = "admin_id", length = 15, nullable = false) - val adminId: String, - @Column(name = "password", length = 60, nullable = false) - val password: String, -) : BaseUUIDEntity(id) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/repository/AdminRepository.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/repository/AdminRepository.kt deleted file mode 100644 index 21fe133..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/domain/repository/AdminRepository.kt +++ /dev/null @@ -1,9 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.domain.repository - -import hs.kr.entrydsm.user.domain.admin.domain.Admin -import org.springframework.data.jpa.repository.JpaRepository -import java.util.UUID - -interface AdminRepository : JpaRepository { - fun findByAdminId(adminId: String): Admin? -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminNotFoundException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminNotFoundException.kt index 439cd13..cc4e5e2 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminNotFoundException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminNotFoundException.kt @@ -1,11 +1,11 @@ package hs.kr.entrydsm.user.domain.admin.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 관리자를 찾을 수 없을 때 발생하는 예외입니다. */ -object AdminNotFoundException : EquusException( +object AdminNotFoundException : CasperException( ErrorCode.ADMIN_NOT_FOUND, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminUnauthorizedException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminUnauthorizedException.kt index fdc0401..a240514 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminUnauthorizedException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/exception/AdminUnauthorizedException.kt @@ -1,11 +1,11 @@ package hs.kr.entrydsm.user.domain.admin.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 관리자 권한이 없을 때 발생하는 예외입니다. */ -object AdminUnauthorizedException : EquusException( +object AdminUnauthorizedException : CasperException( ErrorCode.ADMIN_UNAUTHORIZED, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/AdminController.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/AdminController.kt deleted file mode 100644 index 00ddebe..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/AdminController.kt +++ /dev/null @@ -1,47 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.presentation - -import hs.kr.entrydsm.user.domain.admin.presentation.dto.request.AdminLoginRequest -import hs.kr.entrydsm.user.domain.admin.service.AdminLoginService -import hs.kr.entrydsm.user.domain.admin.service.AdminTokenRefreshService -import hs.kr.entrydsm.user.domain.admin.service.DeleteAllTableService -import hs.kr.entrydsm.user.domain.admin.service.QueryAdminByUUIDService -import hs.kr.entrydsm.user.global.utils.token.dto.TokenResponse -import org.springframework.web.bind.annotation.DeleteMapping -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController -import java.util.UUID -import jakarta.validation.Valid - -@RestController -@RequestMapping("/admin") -class AdminController( - private val adminLoginService: AdminLoginService, - private val adminTokenRefreshService: AdminTokenRefreshService, - private val deleteAllTableService: DeleteAllTableService, - private val queryAdminByUUIDService: QueryAdminByUUIDService, -) { - @PostMapping("/auth") - fun login( - @RequestBody @Valid - adminLoginRequest: AdminLoginRequest, - ): TokenResponse = adminLoginService.execute(adminLoginRequest) - - @PutMapping("/auth") - fun tokenRefresh( - @RequestHeader("X-Refresh-Token") refreshToken: String, - ): TokenResponse = adminTokenRefreshService.execute(refreshToken) - - @DeleteMapping("/auth") - fun deleteAllTable() = deleteAllTableService.execute() - - @GetMapping("/{adminId}") - fun findAdminById( - @PathVariable adminId: UUID, - ) = queryAdminByUUIDService.execute(adminId) -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/request/AdminLoginRequest.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/request/AdminLoginRequest.kt deleted file mode 100644 index ab6645a..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/request/AdminLoginRequest.kt +++ /dev/null @@ -1,10 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.presentation.dto.request - -import jakarta.validation.constraints.NotBlank - -data class AdminLoginRequest( - @NotBlank - val adminId: String, - @NotBlank - val password: String, -) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/response/InternalAdminResponse.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/response/InternalAdminResponse.kt deleted file mode 100644 index 6e38dfc..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/presentation/dto/response/InternalAdminResponse.kt +++ /dev/null @@ -1,7 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.presentation.dto.response - -import java.util.UUID - -data class InternalAdminResponse( - val id: UUID, -) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminLoginService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminLoginService.kt deleted file mode 100644 index 0e9abaf..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminLoginService.kt +++ /dev/null @@ -1,43 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.service - -import hs.kr.entrydsm.user.domain.admin.domain.repository.AdminRepository -import hs.kr.entrydsm.user.domain.admin.exception.AdminNotFoundException -import hs.kr.entrydsm.user.domain.admin.presentation.dto.request.AdminLoginRequest -import hs.kr.entrydsm.user.domain.user.domain.UserInfo -import hs.kr.entrydsm.user.domain.user.domain.UserRole -import hs.kr.entrydsm.user.domain.user.domain.repository.UserInfoRepository -import hs.kr.entrydsm.user.domain.user.exception.PasswordNotValidException -import hs.kr.entrydsm.user.global.security.jwt.JwtProperties -import hs.kr.entrydsm.user.global.security.jwt.JwtTokenProvider -import hs.kr.entrydsm.user.global.utils.token.dto.TokenResponse -import org.springframework.security.crypto.password.PasswordEncoder -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional - -@Service -class AdminLoginService( - private val adminRepository: AdminRepository, - private val passwordEncoder: PasswordEncoder, - private val jwtTokenProvider: JwtTokenProvider, - private val userInfoRepository: UserInfoRepository, - private val jwtProperties: JwtProperties, -) { - @Transactional - fun execute(adminLoginRequest: AdminLoginRequest): TokenResponse { - val admin = adminRepository.findByAdminId(adminLoginRequest.adminId) ?: throw AdminNotFoundException - - if (!passwordEncoder.matches(adminLoginRequest.password, admin.password)) { - throw PasswordNotValidException - } - val tokenResponse = jwtTokenProvider.generateToken(admin.id.toString(), UserRole.ADMIN.toString()) - val userInfo = - UserInfo( - token = tokenResponse.accessToken, - userId = jwtTokenProvider.getSubjectWithExpiredCheck(tokenResponse.accessToken), - userRole = jwtTokenProvider.getRole(tokenResponse.accessToken), - ttl = jwtProperties.accessExp, - ) - userInfoRepository.save(userInfo) - return tokenResponse - } -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminTokenRefreshService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminTokenRefreshService.kt deleted file mode 100644 index a49d04c..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/AdminTokenRefreshService.kt +++ /dev/null @@ -1,14 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.service - -import hs.kr.entrydsm.user.global.security.jwt.JwtTokenProvider -import hs.kr.entrydsm.user.global.utils.token.dto.TokenResponse -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional - -@Service -class AdminTokenRefreshService( - private val jwtTokenProvider: JwtTokenProvider, -) { - @Transactional - fun execute(refreshToken: String): TokenResponse = jwtTokenProvider.reIssue(refreshToken) -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/DeleteAllTableService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/DeleteAllTableService.kt deleted file mode 100644 index d17adf3..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/DeleteAllTableService.kt +++ /dev/null @@ -1,11 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.service - -import hs.kr.entrydsm.user.infrastructure.kafka.producer.DeleteAllTableProducer -import org.springframework.stereotype.Service - -@Service -class DeleteAllTableService( - private val deleteAllTableProducer: DeleteAllTableProducer, -) { - fun execute() = deleteAllTableProducer.send() -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/QueryAdminByUUIDService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/QueryAdminByUUIDService.kt deleted file mode 100644 index 67b323c..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/admin/service/QueryAdminByUUIDService.kt +++ /dev/null @@ -1,22 +0,0 @@ -package hs.kr.entrydsm.user.domain.admin.service - -import hs.kr.entrydsm.user.domain.admin.domain.repository.AdminRepository -import hs.kr.entrydsm.user.domain.admin.exception.AdminNotFoundException -import hs.kr.entrydsm.user.domain.admin.presentation.dto.response.InternalAdminResponse -import org.springframework.data.repository.findByIdOrNull -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional -import java.util.UUID - -@Service -class QueryAdminByUUIDService( - private val adminRepository: AdminRepository, -) { - @Transactional(readOnly = true) - fun execute(adminId: UUID): InternalAdminResponse { - val admin = adminRepository.findByIdOrNull(adminId) ?: throw AdminNotFoundException - return InternalAdminResponse( - id = admin.id!!, - ) - } -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/PassPopupService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/PassPopupService.kt index b339263..67291af 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/PassPopupService.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/PassPopupService.kt @@ -6,6 +6,7 @@ import hs.kr.entrydsm.user.global.exception.InternalServerErrorException import hs.kr.entrydsm.user.global.utils.pass.RedirectUrlChecker import kcb.module.v3.OkCert import org.json.JSONObject +import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/QueryPassInfoService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/QueryPassInfoService.kt index 8dafd3b..88b6b21 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/QueryPassInfoService.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/application/service/QueryPassInfoService.kt @@ -6,6 +6,7 @@ import hs.kr.entrydsm.user.domain.auth.adapter.out.repository.PassInfoRepository import hs.kr.entrydsm.user.domain.auth.application.port.`in`.QueryPassInfoUseCase import hs.kr.entrydsm.user.domain.auth.exception.InvalidPassException import hs.kr.entrydsm.user.global.utils.encryption.EncryptionUtil +import hs.kr.entrydsm.user.global.utils.encryption.HashUtil import hs.kr.entrydsm.user.global.utils.pass.PassUtil import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/PassInfo.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/PassInfo.kt deleted file mode 100644 index 0318c78..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/PassInfo.kt +++ /dev/null @@ -1,16 +0,0 @@ -package hs.kr.entrydsm.user.domain.auth.domain - -import org.springframework.data.annotation.Id -import org.springframework.data.redis.core.RedisHash -import org.springframework.data.redis.core.TimeToLive -import org.springframework.data.redis.core.index.Indexed - -@RedisHash -class PassInfo( - @Id - val name: String, - @Indexed - val phoneNumber: String, - @TimeToLive - val ttl: Long, -) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/repository/PassInfoRepository.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/repository/PassInfoRepository.kt deleted file mode 100644 index 3da504f..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/domain/repository/PassInfoRepository.kt +++ /dev/null @@ -1,11 +0,0 @@ -package hs.kr.entrydsm.user.domain.auth.domain.repository - -import hs.kr.entrydsm.user.domain.auth.domain.PassInfo -import org.springframework.data.repository.CrudRepository -import java.util.Optional - -interface PassInfoRepository : CrudRepository { - fun findByPhoneNumber(phoneNumber: String): Optional - - fun existsByPhoneNumber(phoneNumber: String): Boolean -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidOkCertConnectException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidOkCertConnectException.kt index e3beb24..4088d4e 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidOkCertConnectException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidOkCertConnectException.kt @@ -1,11 +1,11 @@ package hs.kr.entrydsm.user.domain.auth.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * OkCert 연결이 유효하지 않을 때 발생하는 예외입니다. */ -object InvalidOkCertConnectException : EquusException( +object InvalidOkCertConnectException : CasperException( ErrorCode.INVALID_OKCERT_CONNECTION, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidPassException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidPassException.kt index 630d571..53469d6 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidPassException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidPassException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.auth.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * Pass 인증이 유효하지 않을 때 발생하는 예외입니다. * Pass 인증 과정에서 검증에 실패한 경우 사용됩니다. */ -object InvalidPassException : EquusException( +object InvalidPassException : CasperException( ErrorCode.INVALID_PASS, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidUrlException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidUrlException.kt index 1bdd34d..318df1a 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidUrlException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/InvalidUrlException.kt @@ -1,11 +1,11 @@ package hs.kr.entrydsm.user.domain.auth.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * URL이 유효하지 않을 때 발생하는 예외입니다. */ -object InvalidUrlException : EquusException( +object InvalidUrlException : CasperException( ErrorCode.INVALID_URL, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/PassInfoNotFoundException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/PassInfoNotFoundException.kt index b962709..3a59145 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/PassInfoNotFoundException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/exception/PassInfoNotFoundException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.auth.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * Pass 인증 정보를 찾을 수 없을 때 발생하는 예외입니다. * Pass 인증을 통해 저장된 사용자 정보가 만료되었거나 존재하지 않는 경우 사용됩니다. */ -object PassInfoNotFoundException : EquusException( +object PassInfoNotFoundException : CasperException( ErrorCode.PASS_INFO_NOT_FOUND, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/PassInfoController.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/PassInfoController.kt deleted file mode 100644 index 4822fc8..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/PassInfoController.kt +++ /dev/null @@ -1,30 +0,0 @@ -package hs.kr.entrydsm.user.domain.auth.presentation - -import hs.kr.entrydsm.user.domain.auth.presentation.dto.request.PassPopupRequest -import hs.kr.entrydsm.user.domain.auth.presentation.dto.resopnse.QueryPassInfoResponse -import hs.kr.entrydsm.user.domain.auth.service.PassPopupService -import hs.kr.entrydsm.user.domain.auth.service.QueryPassInfoService -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.RestController -import jakarta.validation.Valid - -@RestController -@RequestMapping("/user/verify") -class PassInfoController( - private val passPopupService: PassPopupService, - private val queryPassInfoService: QueryPassInfoService, -) { - @GetMapping("/info") - fun getPassInfo( - @RequestParam("mdl_tkn") token: String, - ): QueryPassInfoResponse = queryPassInfoService.execute(token) - - @PostMapping("/popup") - fun popupPass( - @RequestBody request: @Valid PassPopupRequest, - ): String = passPopupService.execute(request) -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/dto/resopnse/QueryPassInfoResponse.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/dto/resopnse/QueryPassInfoResponse.kt deleted file mode 100644 index 9bb1087..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/presentation/dto/resopnse/QueryPassInfoResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package hs.kr.entrydsm.user.domain.auth.presentation.dto.resopnse - -data class QueryPassInfoResponse( - val phoneNumber: String, - val name: String, -) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/service/QueryPassInfoService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/service/QueryPassInfoService.kt deleted file mode 100644 index fae2b0f..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/auth/service/QueryPassInfoService.kt +++ /dev/null @@ -1,43 +0,0 @@ -package hs.kr.entrydsm.user.domain.auth.service - -import hs.kr.entrydsm.user.domain.auth.domain.PassInfo -import hs.kr.entrydsm.user.domain.auth.domain.repository.PassInfoRepository -import hs.kr.entrydsm.user.domain.auth.exception.InvalidPassException -import hs.kr.entrydsm.user.domain.auth.presentation.dto.resopnse.QueryPassInfoResponse -import hs.kr.entrydsm.user.global.utils.pass.PassUtil -import org.springframework.beans.factory.annotation.Value -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional - -@Service -class QueryPassInfoService( - private val passInfoRepository: PassInfoRepository, - private val passUtil: PassUtil, -) { - companion object { - private val RESULT_CODE = "RSLT_CD" - - private val RESULT_NAME = "RSLT_NAME" - - private val TEL_NO = "TEL_NO" - - private val RESULT_CODE_OK = "B000" - } - - @Value("\${pass.exp}") - private var exp: Long = 0L - - @Transactional - fun execute(token: String?): QueryPassInfoResponse { - val resJson = passUtil.getResponseJson(token) - val resultCode = resJson!!.getString(RESULT_CODE) - if (RESULT_CODE_OK != resultCode) { - throw InvalidPassException - } - val name = resJson.getString(RESULT_NAME) - val phoneNumber = resJson.getString(TEL_NO) - val passInfo: PassInfo = PassInfo(name, phoneNumber, exp) - passInfoRepository.save(passInfo) - return QueryPassInfoResponse(phoneNumber, name) - } -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/RefreshToken.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/RefreshToken.kt deleted file mode 100644 index b622083..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/RefreshToken.kt +++ /dev/null @@ -1,21 +0,0 @@ -package hs.kr.entrydsm.user.domain.refreshtoken.domain - -import org.springframework.data.annotation.Id -import org.springframework.data.redis.core.RedisHash -import org.springframework.data.redis.core.TimeToLive -import org.springframework.data.redis.core.index.Indexed - -@RedisHash -class RefreshToken( - @Id - val id: String, - @Indexed - var token: String, - @TimeToLive - var ttl: Long, -) { - fun update(token: String?, ttl: Long,) { - this.token = token!! - this.ttl = ttl - } -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/repository/RefreshTokenRepository.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/repository/RefreshTokenRepository.kt deleted file mode 100644 index b2c7bc6..0000000 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/refreshtoken/domain/repository/RefreshTokenRepository.kt +++ /dev/null @@ -1,8 +0,0 @@ -package hs.kr.entrydsm.user.domain.refreshtoken.domain.repository - -import hs.kr.entrydsm.user.domain.refreshtoken.domain.RefreshToken -import org.springframework.data.repository.CrudRepository - -interface RefreshTokenRepository : CrudRepository { - fun findByToken(token: String): RefreshToken? -} diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/adapter/out/mapper/UserMapper.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/adapter/out/mapper/UserMapper.kt index b32272f..20c7e52 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/adapter/out/mapper/UserMapper.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/adapter/out/mapper/UserMapper.kt @@ -12,11 +12,8 @@ import org.mapstruct.Mapping */ @Mapper(componentModel = "spring") abstract class UserMapper : GenericMapper { - - @Mapping(target = "changePassword", ignore = true) - @Mapping(target = "changeReceiptCode", ignore = true) + abstract override fun toEntity(model: User): UserJpaEntity - abstract override fun toModel(entity: UserJpaEntity?): User? abstract override fun toModelNotNull(entity: UserJpaEntity): User } diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/application/service/ChangePasswordService.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/application/service/ChangePasswordService.kt index e6c9198..e96ba5a 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/application/service/ChangePasswordService.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/application/service/ChangePasswordService.kt @@ -7,6 +7,7 @@ import hs.kr.entrydsm.user.domain.user.application.port.`in`.ChangePasswordUseCa import hs.kr.entrydsm.user.domain.user.application.port.out.QueryUserPort import hs.kr.entrydsm.user.domain.user.application.port.out.SaveUserPort import hs.kr.entrydsm.user.domain.user.exception.UserNotFoundException +import hs.kr.entrydsm.user.global.utils.encryption.HashUtil import org.springframework.security.crypto.password.PasswordEncoder import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordMisMatchException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordMisMatchException.kt index 1bd0002..d2a4813 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordMisMatchException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordMisMatchException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.user.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 비밀번호가 일치하지 않을 때 발생하는 예외입니다. * 사용자가 입력한 비밀번호가 저장된 비밀번호와 다른 경우 사용됩니다. */ -object PasswordMisMatchException : EquusException( +object PasswordMisMatchException : CasperException( ErrorCode.PASSWORD_MISS_MATCH, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordNotValidException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordNotValidException.kt index 396ee09..71f7362 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordNotValidException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/PasswordNotValidException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.user.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 패스워드가 유효하지 않을 때 발생하는 예외입니다. * 로그인 시 입력한 비밀번호가 잘못된 경우 사용됩니다. */ -object PasswordNotValidException : EquusException( +object PasswordNotValidException : CasperException( ErrorCode.INVALID_USER_PASSWORD, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserAlreadyExistsException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserAlreadyExistsException.kt index ee633bf..bb346ec 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserAlreadyExistsException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserAlreadyExistsException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.user.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 사용자가 이미 존재할 때 발생하는 예외입니다. * 회원가입 시 이미 등록된 전화번호로 가입을 시도하는 경우 사용됩니다. */ -object UserAlreadyExistsException : EquusException( +object UserAlreadyExistsException : CasperException( ErrorCode.USER_ALREADY_EXISTS, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserNotFoundException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserNotFoundException.kt index 39c9709..f740c2a 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserNotFoundException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/domain/user/exception/UserNotFoundException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.domain.user.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 사용자를 찾을 수 없을 때 발생하는 예외입니다. * 요청한 사용자 정보가 시스템에 존재하지 않는 경우 사용됩니다. */ -object UserNotFoundException : EquusException( +object UserNotFoundException : CasperException( ErrorCode.USER_NOT_FOUND, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/document/admin/AdminApiDocument.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/document/admin/AdminApiDocument.kt index 0266ca8..d3c269b 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/document/admin/AdminApiDocument.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/document/admin/AdminApiDocument.kt @@ -1,7 +1,7 @@ package hs.kr.entrydsm.user.global.document.admin import hs.kr.entrydsm.user.domain.admin.adapter.`in`.web.dto.request.AdminLoginRequest -import hs.kr.entrydsm.user.domain.admin.adapter.`in`.web.dto.response.InternalAdminResponse +import hs.kr.entrydsm.user.infrastructure.grpc.server.dto.InternalAdminResponse import hs.kr.entrydsm.user.global.utils.token.dto.TokenResponse import io.swagger.v3.oas.annotations.Operation import io.swagger.v3.oas.annotations.Parameter diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionFilter.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionFilter.kt index bbc70ec..96a87a2 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionFilter.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionFilter.kt @@ -1,7 +1,7 @@ package hs.kr.entrydsm.user.global.error import com.fasterxml.jackson.databind.ObjectMapper -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode import io.sentry.Sentry import jakarta.servlet.FilterChain @@ -36,7 +36,7 @@ class GlobalExceptionFilter( ) { try { filterChain.doFilter(request, response) - } catch (e: EquusException) { + } catch (e: CasperException) { Sentry.captureException(e) writerErrorCode(response, e.errorCode) } catch (e: Exception) { diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionHandler.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionHandler.kt index 135032a..9d3c554 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionHandler.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/error/GlobalExceptionHandler.kt @@ -1,12 +1,11 @@ package hs.kr.entrydsm.user.global.error -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.MethodArgumentNotValidException import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.RestControllerAdvice -import kotlin.collections.get /** * 애플리케이션의 전역 예외 처리를 담당하는 클래스입니다. @@ -20,8 +19,8 @@ class GlobalExceptionHandler { * @param e EquusException 인스턴스 * @return 에러 코드에 따른 응답 엔티티 */ - @ExceptionHandler(EquusException::class) - fun handlingEquusException(e: EquusException): ResponseEntity { + @ExceptionHandler(CasperException::class) + fun handlingEquusException(e: CasperException): ResponseEntity { val code = e.errorCode return ResponseEntity( ErrorResponse(code.status, code.message), diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/ExpiredTokenException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/ExpiredTokenException.kt index 182c660..49d95ab 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/ExpiredTokenException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/ExpiredTokenException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.global.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 토큰이 만료되었을 때 발생하는 예외입니다. * JWT 토큰의 유효 기간이 만료된 경우 사용됩니다. */ -object ExpiredTokenException : EquusException( +object ExpiredTokenException : CasperException( ErrorCode.EXPIRED_TOKEN, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InternalServerErrorException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InternalServerErrorException.kt index 803a1ef..2c2adb0 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InternalServerErrorException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InternalServerErrorException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.global.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 내부 서버 오류가 발생했을 때 사용하는 예외입니다. * 예상치 못한 서버 측 오류가 발생한 경우 사용됩니다. */ -object InternalServerErrorException : EquusException( +object InternalServerErrorException : CasperException( ErrorCode.INTERNAL_SERVER_ERROR, ) diff --git a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InvalidTokenException.kt b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InvalidTokenException.kt index e6b3fdc..1530504 100644 --- a/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InvalidTokenException.kt +++ b/casper-user/src/main/kotlin/hs/kr/entrydsm/user/global/exception/InvalidTokenException.kt @@ -1,12 +1,12 @@ package hs.kr.entrydsm.user.global.exception -import hs.kr.entrydsm.user.global.error.exception.EquusException +import hs.kr.entrydsm.user.global.error.exception.CasperException import hs.kr.entrydsm.user.global.error.exception.ErrorCode /** * 토큰이 유효하지 않을 때 발생하는 예외입니다. * JWT 토큰의 형식이 잘못되었거나 서명이 일치하지 않는 경우 사용됩니다. */ -object InvalidTokenException : EquusException( +object InvalidTokenException : CasperException( ErrorCode.INVALID_TOKEN, )