목록2024/08/03 (1)
Hanbit the Developer
[Spring Boot] ArgumentResolver로 Controller 간소화하기
기존 코드@PostMappingpublic ApiResponse createChat(@RequestBody Req req, @RequestHeader("Authorization") String authorization) { // 토큰 유효성 검증 if (!jwtUtil.validateAuthorizationHeader(authorization)) { throw new InvalidAuthorizationHeaderException(); } // 토큰에서 사용자 추출하기 String token = jwtUtil.extractTokenFromAuthorizationHeader(authorization); String username = jwtUtil.extract..
Back-end
2024. 8. 3. 18:30