Witam. Uczę się Spring Security. Stworzyłem wszystko co potrzeba aby wykonać logowanie i działa, używam do tego thymeleafa. Tworzę kontroller, a w nim dodaje funkcje:

@RequestMapping(value = "/login", method = RequestMethod.GET)
    public String lofinForm(Model model) {
        model.addAttribute("user", new User());
        return "loginForm";
    }

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public String loginProcess(@ModelAttribute User user) {
        return "loginForm";
    }

Konfiguracja Spring Security:

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
@ComponentScan("spring.security")
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Inject
    private UserDetailsService userDetailsService;

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Inject
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .userDetailsService(userDetailsService)
                .passwordEncoder(passwordEncoder());
        //.and()
        //.authenticationProvider(customAuthenticationProvider);
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring()
                .antMatchers("/resources/**");
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf()
                    .disable()
                .authorizeRequests()
                    .antMatchers("/").permitAll()
                .and()
                    .formLogin()
                    .loginPage("/login")
                    .loginProcessingUrl("/login")
                    .defaultSuccessUrl("/")
                    .failureUrl("/login?error")
                    .usernameParameter("username")
                    .passwordParameter("password")
                    .permitAll()
                .and()
                    .logout()
                    .logoutUrl("/logout")
                    .logoutSuccessUrl("/");

    }
}

i wszystko działa jak trzeba.

Teraz zastanawiam się jak stworzyć odpowiednią funkcję restową na wzór funkcji kontrolera, która logowałaby użytkownika.
Wiem, że powinienem wysłać do niej jakieś DTO lub całego użytkownika, ale nie wiem co dalej.