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:

public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    private String DOMAIN;

    private String URL;

    public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
        ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(DOMAIN, URL);
        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:

protected void configure(HttpSecurity http) throws Exception {

But to no avail. How to fix this issue?