Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable multiple session support in Spring Session

I would like to use Spring Session in an xml-config-based project, but without support for multiple sessions (user-logins) in the same browser window.

Can that be disabled? If yes, how?

like image 910
yglodt Avatar asked May 23 '26 22:05

yglodt


1 Answers

As per CookieHttpSessionStrategy#setSessionAliasParamName javadoc:

Sets the name of the HTTP parameter that is used to specify the session alias. If the value is null, then only a single session is supported per browser.

So with Spring XML config this translates to:

<bean class="org.springframework.session.web.http.CookieHttpSessionStrategy">
    <property name="sessionAliasParamName">
        <null/>
    </property>
</bean>
like image 159
Vedran Pavic Avatar answered May 26 '26 10:05

Vedran Pavic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!