grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.79k stars 949 forks source link

Problem with flash messages, after redirect using spring-security and spring-redis #10708

Closed ajdevries closed 7 years ago

ajdevries commented 7 years ago

Thanks for reporting an issue for Grails framework, please review the task list below before submitting the issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.

Task List

Steps to Reproduce

Expected Behaviour

Expecting a flash message

Actual Behaviour

No flash message is shown, probably cleaned up or not saved in the session?

Environment Information

Example Application

erichelgeson commented 7 years ago

spring-sesion's session objects are not mutable by default for performance reasons, see https://github.com/spring-projects/spring-session/issues/177

If you want to make them mutable you can either the grails 3 spring-session plugin wich has this as a config option https://github.com/jeetmp3/spring-session

Or

Implement your own session synchronizer (this is the approach I take, and only update if the flash object has changed) - you can find an example from the same plugin mentioned above https://github.com/jeetmp3/spring-session/blob/master/src/main/java/org/grails/plugins/springsession/web/http/HttpSessionSynchronizer.java

Stack overflow or slack are probably better places to ask these types of questions.

ajdevries commented 7 years ago

Thanks for your reply. So if I want to do redis session replication in grails, what is the best option there?

ajdevries commented 7 years ago

When using https://github.com/jeetmp3/spring-session it works, thanks @erichelgeson for helping out!