Notice
Recent Posts
Recent Comments
Link
목록Spring (1)
solyrion
[Spring Security] CustomUserDetails
스프링 시큐리티를 사용해서 로그인을 구현했다면, 실제 Controller나 Service 계층에서 로그인 한 Member의 정보를 활용해야 합니다.사용자 로그인- Spring Security가 UserDetailsService의 loadUserByUsername(username)을 호출하여 UserDetails 객체를 가져옴.- 해당 UserDetails 객체는 SecurityContext에 저장됨.- 이후 @AuthenticationPrincipal을 사용하면, 현재 로그인한 사용자의 UserDetails 객체를 가져올 수 있음. 따라서 저는 처음에 아래와 같이 코드를 작성했습니다.@PatchMapping("/{postId}")public void updatePost(@PathVariable Long ..
Spring
2025. 2. 6. 20:27