对会话使用sessionRegistry没有会话数限制? [英] Use sessionRegistry without session count limit for user?

查看:1261
本文介绍了对会话使用sessionRegistry没有会话数限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

@Autovired
SessionRegistry sessionRegistry

在我的代码中我添加了以下配置:

in my code I have added following configuration:

http.sessionManagement()
        .maximumSessions(1)
        .sessionRegistry(sessionRegistry());

但我不想限制最多会话。

But I don't want to limit maximum sessions.

我能实现吗?

推荐答案

-1 - 特别值得说春天不限制用户会话

-1 - special value to say spring don't limit user sessions

http.sessionManagement()
        .maximumSessions(-1)
        .sessionRegistry(sessionRegistry());

https://docs.spring.io/spring-security/site/docs/5.0.0。 BUILD-SNAPSHOT / reference / htmlsingle /#list-authenticated-principals

这篇关于对会话使用sessionRegistry没有会话数限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆