Skip to content

Commit

Permalink
♻️ :: SecretValue 주석처리
Browse files Browse the repository at this point in the history
  • Loading branch information
jyk1029 committed Jun 2, 2023
1 parent 247967a commit d512df9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
}
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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() }
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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() }
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d512df9

Please sign in to comment.