Skip to content

Commit

Permalink
Fixing two small issues with invalid sessions and cookies
Browse files Browse the repository at this point in the history
I was encountering two small issues with the plugin.

The first was that the first time I visited the application I would get
an AssertionFailed exception.

The second was that after a session was invalidated the application
would create a duplicate session cookie, causing my session information
to get lost.  This happened in Chrome, not sure if that had something
to do with it.  It should now ensure that the cookie that is returned
has the same path and host as the original cookie.

Also revved the version to the next micro plus snapshot.
  • Loading branch information
sronderos committed Mar 20, 2012
1 parent 295e9f9 commit 71eb8af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DatabaseSessionGrailsPlugin.groovy
Expand Up @@ -5,7 +5,7 @@ import grails.util.Metadata
import org.springframework.web.filter.DelegatingFilterProxy

class DatabaseSessionGrailsPlugin {
String version = '1.1.2'
String version = '1.1.3-SNAPSHOT'
String grailsVersion = '1.3.3 > *'
String title = 'Database Session Plugin'
String author = 'Burt Beckwith'
Expand Down
Expand Up @@ -68,7 +68,8 @@ protected HttpSession proxySession(final boolean create, final HttpServletReques

// no session cookie but do create
log.debug("No session cookie but create is true, creating session");
createSession(request, response);
sessionId = createSession(request, response);
return new SessionProxy(getServletContext(), persister, sessionId);
}

if (persister.isValid(sessionId)) {
Expand Down Expand Up @@ -130,7 +131,7 @@ protected void createCookie(String sessionId, HttpServletRequest request, HttpSe
}
else {
log.debug("Updating existing cookie with id {} to new value {}", cookie.getValue(), sessionId);
cookie.setValue(sessionId);
cookie = newCookie(sessionId, request);
}
response.addCookie(cookie);
}
Expand Down

1 comment on commit 71eb8af

@quorak
Copy link

@quorak quorak commented on 71eb8af Apr 3, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work for me with spring-security plugin cant login!

Please sign in to comment.