Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jroper
Copy link
Member

@jroper jroper commented Oct 3, 2014

Using Play for Java version 2.2.3

I've created a small sample app here: https://github.com/Ronnie76er/play-csrf-issue.

What I'm trying to do is add another variable to the play session. It works fine when a cookie with a CSRF token is already established. However, if you call the endpoint with no cookie, you cannot modify the session any further.

I believe what is happening is that Http.Context.current() doesn't get you the current context that's going to be returned with the call, therefore your modifications to the session are useless.

Fixes playframework#3471

Introduced a wrapped context, so calls to mutable objects in the context
such as the session modify the original context, not the new one.
@jroper
Copy link
Member

jroper commented Oct 3, 2014

Pull request attached.

Backport to 2.3.x and 2.2.x required.

huntc added a commit that referenced this pull request Oct 3, 2014
Cannot modify PLAY_SESSION when calling with no cookie and CSRF token is added to session
@huntc huntc merged commit a898932 into playframework:master Oct 3, 2014
@jroper jroper deleted the 3471-csrf-session branch October 3, 2014 05:28
jroper added a commit that referenced this pull request Oct 3, 2014
Fixes #3471

Introduced a wrapped context, so calls to mutable objects in the context
such as the session modify the original context, not the new one.
@jroper
Copy link
Member

jroper commented Oct 3, 2014

Backported to 2.3.x: a5a11b9

jroper added a commit that referenced this pull request Oct 6, 2014
Fixes #3471

Introduced a wrapped context, so calls to mutable objects in the context
such as the session modify the original context, not the new one.
@jroper
Copy link
Member

jroper commented Oct 6, 2014

Backported to 2.2.x: cc7491f

@jroper jroper added this to the 2.2.5 milestone Oct 7, 2014
ClaraAllende pushed a commit to ClaraAllende/playframework that referenced this pull request Aug 28, 2015
Fixes playframework#3471

Introduced a wrapped context, so calls to mutable objects in the context
such as the session modify the original context, not the new one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants