From d512df98c56a6ceb7fbb1588da309859b146d8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=98=81?= Date: Tue, 30 May 2023 10:22:22 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20SecretValue=20?= =?UTF-8?q?=EC=A3=BC=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/aop/RequestHeaderAspect.kt | 8 +++---- .../v1userservice/user/router/UserHandler.kt | 22 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/aop/RequestHeaderAspect.kt b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/aop/RequestHeaderAspect.kt index fa9312a8..d359f477 100644 --- a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/aop/RequestHeaderAspect.kt +++ b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/aop/RequestHeaderAspect.kt @@ -9,8 +9,8 @@ import java.util.UUID @Component class RequestHeaderAspect( - @Value("\${security.value}") - private val secret: String, + /*@Value("\${security.value}") + private val secret: String,*/ ) { fun getUserId(serverRequest: ServerRequest): UUID { @@ -20,10 +20,10 @@ class RequestHeaderAspect( return UUID.fromString(userId) } - fun getSecretValue(serverRequest: ServerRequest) { + /*fun getSecretValue(serverRequest: ServerRequest) { val secretValue = serverRequest.headers().firstHeader("Request-Xquare-Secret") if ((secretValue == null) || (secretValue != secret)) { throw InvalidSecretValueException("Secret is invalid") } - } + }*/ } diff --git a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/router/UserHandler.kt b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/router/UserHandler.kt index ba3a2fb0..031858ef 100644 --- a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/router/UserHandler.kt +++ b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/user/router/UserHandler.kt @@ -91,7 +91,7 @@ class UserHandler( suspend fun getUserByIdHandler(serverRequest: ServerRequest): ServerResponse { val userId = serverRequest.pathVariable("userId") - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val user = userApi.getUserById(UUID.fromString(userId)) val userResponseDto = user.toGetUserByAccountIdResponseDto() @@ -102,7 +102,7 @@ class UserHandler( suspend fun getUserByIdsInHandler(serverRequest: ServerRequest): ServerResponse { val userIds = serverRequest.queryParams()["userId"]?.map { UUID.fromString(it) } ?: throw BadRequestException("userId is required") - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val users = userApi.getUsersByIdsIn(userIds) val userResponseDtos = users.map { it.toGetUserByAccountIdResponseDto() } @@ -112,7 +112,7 @@ class UserHandler( suspend fun getUserByIdsToBodyHandler(serverRequest: ServerRequest): ServerResponse { val userIds = serverRequest.getUserInfoRequestBody() - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val users = userApi.getUsersByIdsIn(userIds.userIds) val userResponseDtos = users.map { it.toGetUserByAccountIdResponseDto() } @@ -125,7 +125,7 @@ class UserHandler( suspend fun getUserByAccountIdHandler(serverRequest: ServerRequest): ServerResponse { val accountId = serverRequest.pathVariable("accountId") - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val user = userApi.getUserByAccountId(accountId) val userResponseDto = user.toGetUserByAccountIdResponseDto() @@ -165,7 +165,7 @@ class UserHandler( suspend fun getUserDeviceTokensHandler(serverRequest: ServerRequest): ServerResponse { val userIds = serverRequest.queryParams()["users"]?.map { UUID.fromString(it) } ?: emptyList() - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val userDeviceTokenDomainResponse = userApi.getUserDeviceTokensByIdIn(userIds) val getUserDeviceTokenListResponse = userDeviceTokenDomainResponse.toGetUserDeviceTokenListResponse() @@ -204,7 +204,7 @@ class UserHandler( val grade = serverRequest.queryParams().getFirst("grade")?.toIntOrNull() ?: throw BadRequestException("grade is required") val classNum = serverRequest.queryParams().getFirst("classNum")?.toIntOrNull() - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val users = userApi.getUserByGradeAndClass(grade, classNum) val userResponse = users.map { it.toGetUserGradeAndClass() } @@ -223,7 +223,7 @@ class UserHandler( } suspend fun getAllStudentHandler(serverRequest: ServerRequest): ServerResponse { - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val users = userApi.getAllStudent() val userResponseDtos = users.map { it.toGetUserByAccountIdResponseDto() } val userListResponse = GetUserListResponse(userResponseDtos) @@ -232,7 +232,7 @@ class UserHandler( } suspend fun getAllTeacherHandler(serverRequest: ServerRequest): ServerResponse { - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val teachers = userApi.getAllTeacher() val teacherInfoResponse = teachers.map { it.toGetTeacherInfoResponseDto() } val teacherResponse = GetTeacherResponse(teacherInfoResponse) @@ -242,7 +242,7 @@ class UserHandler( suspend fun getAllStudentByNameHandler(serverRequest: ServerRequest): ServerResponse { val name = serverRequest.queryParam("name").orElse("") - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val users = userApi.getAllStudentByName(name) val userResponse = users.map { it.toGetUserNameResponseDto() } @@ -252,7 +252,7 @@ class UserHandler( suspend fun getUserByRoleHandler(serverRequest: ServerRequest): ServerResponse { val role = serverRequest.queryParams().getFirst("roleName") ?: throw BadRequestException("roleName is required") - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ checkUserRole(role) val users = userApi.getAllUserByRole(role) @@ -283,7 +283,7 @@ class UserHandler( } suspend fun getExcludeUserListHandler(serverRequest: ServerRequest): ServerResponse { - requestHeaderAspect.getSecretValue(serverRequest) + /*requestHeaderAspect.getSecretValue(serverRequest)*/ val excludeUserIds = serverRequest.getExcludeUserIds().userIdList?.nullIfBlank()?.map { UUID.fromString(it.toString()) } val users = userApi.getExcludeUserIdList(excludeUserIds) val response = ExcludeUserIdListResponse(users)