전체 글

모든 코드에는 이유가 있어야 한다고 생각하는 코딩하는 대학생입니다.
현재 상황@Entity@Getter@Builder@AllArgsConstructor@NoArgsConstructor(access = AccessLevel.PUBLIC)@Table(indexes = @Index(name = "oauth_id", columnList = "oauthId", unique = true))public class Member extends BaseTimeEntity implements UserDetails { @Id private String id; @Column(nullable = false) private String oauthId; @Enumerated(EnumType.STRING) private OAuthProvider oauthPlatform; @Column(nullable..
문제 상황현재 Fixadate의 Signin 과정은 다음과 같습니다.Client(ios)에서 소셜 로그인을 수행한 뒤, 얻은 정보를 Server에게 보냅니다.Server는 받은 정보를 바탕으로 DB에서 해당 회원이 있는지 조회합니다.해당 회원이 DB에 있으면 JWT 토큰을 발급해서 header로 보내고, 없으면 401 exception을 발생시킵니다.이와 같이 진행을 하면 회원이 있는 것과 없는 것을 잘 판단할 수 있지만, 보안 관점에서 보았을 때 매우 위험한 방법입니다. 만약 무차별 대입 공격과 같이 무작위 문자열을 대입하다가 DB에 있는 회원의 oauthId와 일치하게 되어 jwt를 발급하게 되면 한 사람의 일정을 다른 사람이 전부 볼 수 있게 되기 때문에 매우 큰 문제가 될 수 있는 방법입니다. ..
· 왜?
익명의 능력자분께 코드리뷰를 받았을 때 이러한 리뷰를 받았다. 1. DTO란? DTOs or Data Transfer Objects are objects that carry data between processes in order to reduce the number of methods calls. Fowler explained that the pattern’s main purpose is to reduce roundtrips to the server by batching up multiple parameters in a single call. This reduces the network overhead in such remote operations. DTO(Data Transfer Objects)는 프..
StringCharacterIterator? 문자열을 반복하는 친구인가?! 1. Iterator과 StringCharacterIterator의 차이 Iterator이란? An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Framework. 컬렉션에 대한 반복자입니다. Iterator는 Java Collections Framework에서 Enumeration을 대신합니다. 공식문서에서도 볼 수 있듯이 Iterator은 Collection에 대한 반복자입니다. Collection은 데이터를 모아서 저장하는 자료구조를 일반화한 개념입니다. 자바에서는 Collection Framework를 제..
· 왜?
1. Presigned URL이란? 미리 서명된 URL의 생성자가 해당 객체에 대한 액세스 권한을 보유할 경우, 미리 서명된 URL은 URL에서 식별된 객체에 대한 액세스를 부여합니다. 즉, 객체를 업로드하기 위해 미리 서명된 URL을 수신하는 경우, 미리 서명된 URL의 생성자가 해당 객체를 업로드하는 데 필요한 권한을 보유하는 경우에만 객체를 업로드할 수 있습니다. * 미리 서명된 URL은 Presigned URL입니다. AWS 공식문서에서는 Presigned URL을 이렇게 정의하였습니다. 조금 더 쉽게 말하자면 해당 객체를 업로드하는데 필요한 권한을 보유하고 있는 사람이 객체를 업로드하고 싶은 사람에게 서명된 URL을 주는 것입니다. 이를 백엔드와 프론트엔드 개념에 적용시켜 보면 프론트엔드가 백엔..
· 왜?
1. 에러 발생 마이페이지를 위해 Member를 조회한 뒤, dto를 통해 반환하는 API입니다. 406 HttpMediaTypeNotAcceptableException 에러가 발생했습니다. Controller @GetMapping(value = "/user") public ResponseEntity getUserInfo(@AuthenticationPrincipal MemberPrincipal memberPrincipal) { Long id = memberPrincipal.getMember().getId(); MemberInfoResponse memberInfoResponse = memberService.getMemberInfo(id); return ResponseEntity.ok(memberInfoRe..
코딩하는_대학생
코딩하는 대학생에서 개발자까지