Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions articles/tools/kubernetes/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,24 @@ spring:
host: redis-service
----
--

== Backend Session Expiration Policy

Backend session expiration policy allows to define an expiration timeout for the backend stored session. By default no expiration is set, but can be expiration can be activated setting the property or by providing a custom SessionExpirationPolicy bean. If no unit is provided in the property, seconds are assumed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By implementing the SessionExpirationPolicy interface, the developer can define the expiration timeout.
However, the property does not define the timeout value, but the amount of time to be added to the HTTP session timeout to determine the expiration of the backend session. If time unit is not given, milliseconds is assumed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add also a SessionExpirationPolicy implementation example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this suffice for code example?

    @Bean
    SessionExpirationPolicy sessionExpirationPolicy() {
        return Duration.ofMinutes(60);
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SessionExpirationPolicy.apply() method takes current HTTP session timeout as argument

@Bean
SessionExpirationPolicy sessionExpirationPolicy() {
    return sessionTimeout -> Duration.ofMinutes(60);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If time unit is not given, milliseconds is assumed.

This may be the default, but it's not particularly useful. If seconds are more appropriate, perhaps the property should be annotated with @DurationUnit(ChronoUnit.SECONDS) and the original phrasing kept?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sound a good idea


[.example]
--
.application.properties
[source,properties]
----
vaadin.kubernetes.backend-session-expiration-tolerance: duration
----

.application.yaml
[source,yaml]
----
vaadin:
kubernetes:
backend-session-expiration-tolerance: duration
----
--
Loading