Ldap authentication using Spring's ActiveDirectoryLdapAuthenticationProvider error

I am trying to add LDAP authentication to my Spring Boot application. I’ve been using the example at: https://spring.io/guides/gs/authenticating-ldap/

This is my WebSecurityConfig class:

@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Value("${ldap.domain}")
    private String DOMAIN;

    @Value("${ldap.url}")
    private String URL;

    @Bean
    public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
        ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(DOMAIN, URL);
        provider.setConvertSubErrorCodesToExceptions(true);
        provider.setUseAuthenticationRequestCredentials(true);
        return provider;
    }

It enables the login form, and verifies whether entered credentials are correct. However, after logging in I get the following response body:

{“timestamp”:1501239537208,”status”:403,”error”:”Forbidden”,‌​”message”:”Could not verify the provided CSRF token because your session was not found.”,”path”:”/target/create”}

and console prints:

INFO 7616 — [nio-8080-exec-3] o.s.s.ldap.SpringSecurityLdapTemplate :Ignoring PartialResultException

I have tried adding following code:

@Override 
protected void configure(HttpSecurity http) throws Exception {
    http
        .csrf()
            .disable()
            .and()
        .authorizeRequests()
            .anyRequest().fullyAuthenticated()
            .and()
        .formLogin();

But to no avail. How to fix this issue?