SpringBoot24 JwtAuthenticationFilter 내 발생 가능한 Exception 공통 처리 JwtAuthenticationFilter 인증 필터 내 검증되는 부분은 두 종류가 존재한다. 1. ID 존재 여부 2. 비밀번호 일치 여부 두 종류의 검증에 대해 거절 상황 시 하나의 로직으로 응답할 수 있는 방법이 필요하였다.... 인증처리 시 Exception 처리 부분을 먼저 확인해본다. 인증 처리하는 Filter 일부분 1. Authentication authenticationResult = attemptAuthentication(request, response); attemptAuthentication 메소드를 통하여 ID, 패스워드 등 인증한다. 이 때, ID 및 비밀번호 검증 실패 시 AuthenticationException 을 던지게 된다. 2.catch (AuthenticationEx.. 2023. 10. 19. [이슈] AuthenticationProvider 인터페이스 구현 후 적용되지 않는 상황 처리 SpringSecurityConfig 파일 @Configuration @RequiredArgsConstructor @EnableWebSecurity public class SpringSecurityConfig { private final MemberService memberService; private final PasswordEncoder bCryptPasswordEncoder; private final CustomJwtProvider customJwtProvider; private final AuthenticationConfiguration authenticationConfiguration; @Bean public SecurityFilterChain filterChain(HttpSecurity htt.. 2023. 10. 19. org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Library.Library.Member.Member.heartList: could not initialize proxy - no Session 에러 org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Library.Library.Member.Member.heartList: could not initialize proxy - no Sessionorg.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Library.Library.Member.Member.heartList: could not initialize proxy - no Session 발생상황 - 일대다(Member:Heart) 양방향 관계 - 등록되어있는 멤버는 특정 책에 .. 2023. 8. 29. @EmbeddedId @GeneratedValue 복합키 키자동증가 불가 우선 결론부터 말씀드리면, @GeneratedValue와 @EmbeddedId는 같이 못 쓴다고 확인했습니다... DDD를 공부하던 도중 엔티티의 식별자를 Long,String으로 보단 명확하게 알 수 있는 밸류 타입으로 사용하는 방식을 알려주었습니다. 하여 해당 방식을 적용하여 구현하였습니다.(아래 문제점 등장..) 기존) public class Book { @GeneratedValue(strategy = GenerationType.IDENTITY) //기본키 생성을 데이터베이스에 위임(데이터베이스에 의존적), Entity 등록 시 DB에서 AUTO_INCREMENT하여 PK생성 후 INSERT @Column(name = "book_id") private Long bookId; 개선) public cl.. 2023. 5. 16. 이전 1 2 3 4 5 6 다음