@Component public class LoginFilter extends OncePerRequestFilter { // 予めObjectMapperをBean登録しておきます @Autowired ObjectMapper objectMapper; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // コンテキストにログインユーザ情報をセット SecurityContextHolder.getContext().setAuthentication(new PreAuthenticatedAut