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

SpringSessionBackedSessionInformation.EXPIRED not used in expired session clean up #3249

Open
bayang opened this issue Oct 24, 2024 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged type: bug A general bug

Comments

@bayang
Copy link

bayang commented Oct 24, 2024

Describe the bug

I use Jdbc session, I want to mark some sessions as expired.
So I call

//private val sessionRegistry: SessionRegistry,

sessionRegistry.getAllSessions("login", false).forEach {
               it.expireNow()
    }

getAllSessions returns SpringSessionBackedSessionInformation objects.
Calling expireNow on them calls super.expireNow and adds the SpringSessionBackedSessionInformation.EXPIRED attribute.
The times of the session are not touched in DB.

So far so good.

When the clean up job launches in JdbcIndexedSessionRepository it only checks the expiry date, so expired sessions are kept in db.

Example data from DB :

"PRIMARY_ID","SESSION_ID","CREATION_TIME","LAST_ACCESS_TIME","MAX_INACTIVE_INTERVAL","EXPIRY_TIME","PRINCIPAL_NAME"
a296354c-d86a-49ac-9ff5-c9593eec64f4,ba25a393-db6f-4e40-a467-33361df132a5,1729712977529,1729753828691,604800,1730358628691,toto

corresponding attribute :

"SESSION_PRIMARY_ID","ATTRIBUTE_NAME","ATTRIBUTE_BYTES"
"a296354c-d86a-49ac-9ff5-c9593eec64f4",org.springframework.session.security.SpringSessionBackedSessionInformation.EXPIRED,"true"

Expected behavior

clean up cron should delete sessions based on expiry time but also based on the presence of the SpringSessionBackedSessionInformation.EXPIRED attribute.

@bayang bayang added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant