This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| companion object { | |
| private const val ID = "User" | |
| private const val ADMIN = "[email protected]" | |
| private const val EMAIL = "@real.com" | |
| private const val PASSWORD = "existPassword!@#s2" | |
| private const val NICKNAME = "patric" | |
| private const val X_AUTH_TOKEN = "X-AUTH-TOKEN" | |
| } | |
| lateinit var token: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.pepega.common.controller | |
| import com.example.pepega.common.domain.UserMaster | |
| import com.example.pepega.common.dto.sign.request.SignInRequestDto | |
| import com.example.pepega.common.dto.sign.request.SignUpRequestDto | |
| import com.example.pepega.common.repository.UserMasterRepository | |
| import com.example.pepega.common.service.sign.SignService | |
| import org.junit.jupiter.api.BeforeEach | |
| import org.junit.jupiter.api.Test | |
| import org.springframework.beans.factory.annotation.Autowired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.pepega.common.controller | |
| import com.example.pepega.common.dto.user.UsersResponseDto | |
| import com.example.pepega.common.model.response.MutableListResult | |
| import com.example.pepega.common.service.response.ResponseService | |
| import com.example.pepega.common.service.user.UserService | |
| import org.springframework.http.ResponseEntity | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.RequestMapping | |
| import org.springframework.web.bind.annotation.RestController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun <T> mutableListResult(results: MutableList<T>): MutableListResult<T> { | |
| val common = successResult() | |
| return MutableListResult( | |
| common.success, | |
| common.code, | |
| common.message, | |
| results | |
| ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.pepega.common.service.user | |
| import com.example.pepega.common.dto.user.UsersResponseDto | |
| import com.example.pepega.common.repository.UserMasterRepository | |
| import org.springframework.stereotype.Service | |
| @Service | |
| class UserService( | |
| private val userMasterRepository: UserMasterRepository | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.pepega.common.dto.user | |
| data class UsersResponseDto( | |
| val email: String, | |
| val nickName: String, | |
| val roles: MutableList<String> | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.pepega.common.model.response | |
| class MutableListResult<T> ( | |
| success: Boolean, | |
| code: Int, | |
| message:String, | |
| var results: MutableList<T> | |
| ): CommonResult(success, code, message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| entryPointException.code = -1002 | |
| entryPointException.message = You do not have permission to access this resource. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| entryPointException.code = -1002 | |
| entryPointException.message = 해당 리소스에 접근하기 위한 권한이 없습니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ExceptionHandler(value = [AuthenticationException::class]) | |
| fun authenticationEntryPointException(): ResponseEntity<CommonResult> { | |
| return ResponseEntity | |
| .status(HttpStatus.NOT_FOUND) | |
| .body(responseService.failResult( | |
| getMessage("entryPointException.code").toInt(), | |
| getMessage("entryPointException.message"))) | |
| } |