spring-projects / spring-projects/spring-session
Feature: Add support for AbstractSessionEvent for JDBC sessions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Expected Behavior
When a project is configured to use JDBC managed sessions, the application should handle AbstractSessionEvent events, including creation, deletion and expiration events, similar to other Spring Session implementations (eg. Redis).
Current Behavior
When using JDBC sessions, no AbstractSessionEvent events are emitted by the framework. As a result, the application cannot handle the session create, delete or expire events properly..
Context
I am configuring a stateful authentication using JDBC managed sessions together with Spring Security.
My application needs to perform some custom logic whenever the session is expired or deleted from the session store.
The custom logic needs to be done in the application layer, so a trigger in the database would not solve the issue.
It would be easier for the application to listen for session lifecycle events.
As a temporary solution, I solved the issue for my application by implementing a custom request filter that checks the session expiration time before Spring processes the request.
Would it be possible to add support for publishing AbstractSessionEvent events for JDBC session implementations, similar to other Spring Session backends?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the JDBC session implementation with the other Spring Session implementations, especially Redis, to find where AbstractSessionEvent events are published. Trace the JDBC session lifecycle for creation, deletion, and expiration, then add coverage showing that application listeners receive each event; done means JDBC sessions emit the expected lifecycle events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100