-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add configurable backend session expiration policy
Allows to define an expiration policy for the backend stored session. By default no expiration is set, but can be expiration can be activated setting the vaadin.kubernetes.backend-session-expiration-tolerance property or by providing a custom SessionExpirationPolicy bean. Fixes #126
- Loading branch information
1 parent
6d3192e
commit 59eeed5
Showing
13 changed files
with
241 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...in/java/com/vaadin/kubernetes/starter/sessiontracker/backend/SessionExpirationPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.vaadin.kubernetes.starter.sessiontracker.backend; | ||
|
||
import java.time.Duration; | ||
|
||
/** | ||
* A rule that determines the expiration for a backend session based on the | ||
* current HTTP session timeout. | ||
*/ | ||
public interface SessionExpirationPolicy { | ||
|
||
/** | ||
* Computes the maximum amount of time an inactive session should be | ||
* preserved in the backed, based on the given HTTP session timeout | ||
* expressed in seconds. | ||
* <p> | ||
* </p> | ||
* A return value of {@link Duration#ZERO} or less means the backend session | ||
* should never expire. | ||
* | ||
* @param sessionTimeout | ||
* HTTP session timeout expressed in seconds. | ||
* @return the maximum amount of time an inactive session should be | ||
* preserved in the backed. | ||
*/ | ||
Duration apply(long sessionTimeout); | ||
|
||
/** | ||
* A policy that prevents expiration. | ||
*/ | ||
SessionExpirationPolicy NEVER = sessionTimeout -> Duration.ZERO; | ||
|
||
} |
Oops, something went wrong.