Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sessionRegistry get erased upon Grails fast reload #610

Open
ilPittiz opened this issue Jan 7, 2020 · 0 comments
Open

sessionRegistry get erased upon Grails fast reload #610

ilPittiz opened this issue Jan 7, 2020 · 0 comments

Comments

@ilPittiz
Copy link

ilPittiz commented Jan 7, 2020

In a Grails 4 webapp with Spring Security plugin dependency

org.grails.plugins:spring-security-core:4.0.0.RC2

in any controller inject dependencies

def springSecurityService
def sessionRegistry

and include this snippet in an action A:

println 'principal:   ' + springSecurityService.principal?.username
println 'currentUser: ' + springSecurityService.currentUser
println '-------------'
println 'principal sessions: ' + sessionRegistry.getAllSessions(springSecurityService.principal, true)
println 'all principals:     ' + sessionRegistry.allPrincipals.collect { it.username }

Steps to Reproduce

  1. run webapp
  2. login with valid credentials
  3. execute action A
  4. trigger a fast reload (Spring Dev Tools)
  5. execute action A again

Expected Behaviour

Both snippets should print

principal:   [email protected]
currentUser: UserDomainClass(email:[email protected])
-------------
principal sessions: [org.springframework.security.core.session.SessionInformation@644c9f8a]
all principals:     [[email protected]]

Actual Behaviour

2nd execution shows session registry being erased, while principal is maintained as expected

principal:   [email protected]
currentUser: UserDomainClass(email:[email protected])
-------------
principal sessions: []
all principals:     []

Environment Information

  • Operating System: macOS Mojave (10.14.6)
  • GORM Version: 7.0.0
  • Grails Version (if using Grails): 4.0.1
  • JDK Version: 1.8.0_60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant