Make session serializable #121

Merged
niat8586 merged 1 commits from session-serialization-issues into develop 2025-03-03 07:32:26 +01:00
Owner

When re-deploying the application, or restarting Tomcat, it will attempt to serialize the active sessions to prevent users from getting logged out and losing in-progess work. This requires that all attributes that are stored in the session implement java.io.Serializable. Spring stores the entire security context in the session which includes a reference to the principal, and that principal may be of type "WicketControlledPrincipal" and it must therefore be serializable.

How to test

  1. Be on the develop branch
  2. Make sure session preservation is turned on (in IntelliJ check "Preserve sessions across restarts and redeploys", or read https://tomcat.apache.org/tomcat-10.0-doc/config/manager.html#Persistence_Across_Restarts)
  3. Log in as the default admin dev@localhost
  4. Switch to "Sture Student" under "Admin / Users / Switch user"
  5. Restart Tomcat
  6. Refresh page and you'll be prompted to log in again
  7. Switch to this branch and repeat step 1-6
When re-deploying the application, or restarting Tomcat, it will attempt to serialize the active sessions to prevent users from getting logged out and losing in-progess work. This requires that all attributes that are stored in the session implement `java.io.Serializable`. Spring stores the entire security context in the session which includes a reference to the principal, and that principal may be of type "WicketControlledPrincipal" and it must therefore be serializable. ## How to test 1. Be on the `develop` branch 2. Make sure session preservation is turned on (in IntelliJ check "Preserve sessions across restarts and redeploys", or read https://tomcat.apache.org/tomcat-10.0-doc/config/manager.html#Persistence_Across_Restarts) 3. Log in as the default admin `dev@localhost` 4. Switch to "Sture Student" under "Admin / Users / Switch user" 5. Restart Tomcat 6. Refresh page and you'll be prompted to log in again 7. Switch to this branch and repeat step 1-6
ansv7779 added 1 commit 2025-02-27 12:38:11 +01:00
Make session serializable
All checks were successful
Build and test / build-and-test (push) Successful in 15m59s
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 13m22s
Remove branch deployment from branch.dsv.su.se / cleanup (pull_request) Successful in 4s
f3eacbfda4
When re-deploying the application, or restarting Tomcat, it will attempt to serialize the active sessions to prevent users from getting logged out and losing in-progess work. This requires that all attributes that are stored in the session implement java.io.Serializable. Spring stores the entire security context in the session which includes a reference to the principal, and that principal may be of type "WicketControlledPrincipal" and it must therefore be serializable.
First-time contributor
Deployed to https://scipro-session-serialization-issues.branch.dsv.su.se
niat8586 requested review from niat8586 2025-03-03 06:41:38 +01:00
Owner

Could not test with Sture Student, probably something i missed when setting up.

Tried it with other user at my disposal, and behavior was as described both for develop and the branch.

Looks good to me.

Could not test with Sture Student, probably something i missed when setting up. Tried it with other user at my disposal, and behavior was as described both for develop and the branch. Looks good to me.
niat8586 approved these changes 2025-03-03 07:32:13 +01:00
niat8586 left a comment
Owner

👍

👍
niat8586 merged commit ec70ea5596 into develop 2025-03-03 07:32:26 +01:00
niat8586 deleted branch session-serialization-issues 2025-03-03 07:32:26 +01:00
Sign in to join this conversation.
No description provided.