spring-guides / gs-securing-web

Securing a Web Application :: Learn how to protect your web application with Spring Security.

Home Page:http://spring.io/guides/gs/securing-web/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No session is created in sample application

mattesja opened this issue · comments

I'm using the complete webapp of the current 1.5.2.RELAESE.

I do these steps:

  • Start Application from Intellij
  • Calling http://localhost:8080 (tried firefox / chrome)
  • Click on here => calling http://localhost:8080/hello
  • Login page appears
  • Do login with user/password
  • I get an error:
    Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.
    ...
    Could not verify the provided CSRF token because your session was not found.
  • When I disable csrf by .csrf().disable() I get no error, but login does not work either.

The problem is, that no session is created. I can't find any session cookie in my browser.

There is a Cookie Header in the response:
Set-Cookie:JSESSIONID=D59CD127502B46E6F4A88C4629545E65;path=/;HttpOnly

When I intercept add whitespaces, it works:
JSESSIONID=D59CD127502B46E6F4A88C4629545E65; path=/; HttpOnly

Works for me (and there is no whitespace in the set-cookie header). I have Chrome 56.0.2924.87.

When calling http://127.0.0.1:8080/ it works.
That's strange.

I also faced the same issue sometime back. After several close inspection, I could see something get cached in the browser. It will start working when the browser cache is cleared.

Check the issue #28