Напишите пользовательский AuthenticationSuccessHandler, который записывает ваш JSON и подключите его к вашему formLogin ().
.formLogin().successHandler(yourSucessHandlerBean);
Ваш обработчик может выглядеть примерно так:
@Component
public class Securityhandler implements AuthenticationSuccessHandler {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
// write your JSON here, directly to the HttpServletResponse
}
}