1
Problem: Authenticate user using H2 database in Spring Security
Context: The application is made using Spring, the user class is this
@Entity
data class Usuario(
        @NotEmpty
        var nome:String = "",
        @NotEmpty
        var login:String = "",
        @NotEmpty
        var senha:String = "",
        @OneToMany(cascade= arrayOf(CascadeType.ALL), mappedBy="usuario")
        var simulacoes:MutableSet<Simulacao> = mutableSetOf(),
        @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
        var id:Int  = 0
)
Repository of the class :
interface UsuarioRep:JpaRepository<Usuario,Int>{
    fun findByLogin(login:String):Usuario
}
Configuration of Springsecurity:
@Configuration
class SecurityConfig : WebSecurityConfigurerAdapter() {
    override fun configure(http: HttpSecurity): Unit {
        http
                .authorizeRequests()
                .antMatchers("/","/cadastro").permitAll()
                .antMatchers("/principal").hasRole("USER")
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .permitAll()
                .and()
                .logout()
                .permitAll()
        http.exceptionHandling().accessDeniedPage("/");
    }
    @Autowired
    fun configAuthentication(auth: AuthenticationManagerBuilder){
        //
    }
}
I spent a few hours researching and without success, the official documentation is in java and the tutorials are also scarce.
From what I understand I must create a UserDetailsService, but how it can be done in Kotlin?