当前位置: 首页 > news >正文

大连做网站的中联汇科 网站建设

大连做网站的,中联汇科 网站建设,怎么做一个微信公众号,建筑模板尺寸和价格多少钱用户只能单设备登录 有时候在同一个系统中#xff0c;只允许一个用户在一个设备登录。 之前的登陆者被顶掉 将最大会话数设置为1就可以保证用户只能同时在一个设备上登录 Override protected void configure(HttpSecurity http) throws Exception {http..anyRequest().aut…用户只能单设备登录 有时候在同一个系统中只允许一个用户在一个设备登录。 之前的登陆者被顶掉 将最大会话数设置为1就可以保证用户只能同时在一个设备上登录 Override protected void configure(HttpSecurity http) throws Exception {http..anyRequest().authenticated() // 其他需要认证.and().csrf().disable() // 关闭csrf跨站请求伪造防护// 设置一个用户只能在一个设备上登录 设置最大会话数.sessionManagement().maximumSessions(1);}不允许后来者登录 Override protected void configure(HttpSecurity http) throws Exception {http..anyRequest().authenticated() // 其他需要认证.and().csrf().disable() // 关闭csrf跨站请求伪造防护// 设置一个用户只能在一个设备上登录 设置最大会话数.sessionManagement().maximumSessions(1).maxSessionsPreventsLogin(true) // 禁止后来者登录;}源码解读 ConcurrentSessionControlAuthenticationStrategy类 public void onAuthentication(Authentication authentication,HttpServletRequest request, HttpServletResponse response) {// 获取当前用户的所有sessionfinal ListSessionInformation sessions sessionRegistry.getAllSessions(authentication.getPrincipal(), false);int sessionCount sessions.size();// 同时允许几个session存在int allowedSessions getMaximumSessionsForThisUser(authentication); // 当前登录的数量小于允许的数量if (sessionCount allowedSessions) {// They havent got too many login sessions running at presentreturn;} // 不进行限制if (allowedSessions -1) {// We permit unlimited loginsreturn;} // 已经达到允许数量了if (sessionCount allowedSessions) {// 当前session 是否为nullHttpSession session request.getSession(false);if (session ! null) { // 不为null则判断一下是否有与当前session同一个sessionId的// Only permit it though if this request is associated with one of the// already registered sessionsfor (SessionInformation si : sessions) {if (si.getSessionId().equals(session.getId())) {return;}}}// If the session is null, a new one will be created by the parent class,// exceeding the allowed number}// 这里说明session已超过限制数量了allowableSessionsExceeded(sessions, allowedSessions, sessionRegistry); }protected void allowableSessionsExceeded(ListSessionInformation sessions,int allowableSessions, SessionRegistry registry)throws SessionAuthenticationException {// exceptionIfMaximumExceeded该值就是配置的maxSessionsPreventsLoginif (exceptionIfMaximumExceeded || (sessions null)) {throw new SessionAuthenticationException(messages.getMessage(ConcurrentSessionControlAuthenticationStrategy.exceededAllowed,new Object[] { Integer.valueOf(allowableSessions) },Maximum sessions of {0} for this principal exceeded));}// Determine least recently used session, and mark it for invalidationSessionInformation leastRecentlyUsed null;for (SessionInformation session : sessions) {if ((leastRecentlyUsed null)|| session.getLastRequest().before(leastRecentlyUsed.getLastRequest())) {leastRecentlyUsed session;}}leastRecentlyUsed.expireNow();} https://zhhll.icu/2023/框架/springSecurity/6.用户只能单设备登录/
http://www.tj-hxxt.cn/news/217093.html

相关文章:

  • 建设网站培训百度小程序开发者工具
  • 做自己的网站服务器多少钱邹城网站建设
  • 深圳企业网站制作设计方案浙江中天建设集团有限公司网站
  • 什么是网站栏目标题网站营销策略
  • 网站信息化建设存在的困难求个免费网站
  • 做网站提成聊城市 网站制作
  • 建宇建设工程交易中心网站外贸公司网站空间
  • 门户网站怎么建设酒泉网站建设设计
  • 无锡网站建设无锡苏州建设交通职业学校
  • 做网站网站会被判多久免费网站托管平台
  • 网站建设5个why小程序代理模板
  • wordpress网站登录肇庆seo网络推广
  • 亚马逊官方网站的建设俄文网站策划
  • 网站开发技术合同百度云app
  • 紧急页面通知升级中访问大通知淄博网站制作定制优化
  • 网站开发的主要方法网页制作素材软件有哪些
  • 星外网站开发怎么自己做画册网站
  • 广东制作公司网站网站开发成本主要有哪些
  • seo做什么网站赚钱怎样利用互联网进行网络推广
  • 清涧县住房和成乡建设局 网站wordpress语言系统
  • 怎样建设网站网站西部数码网站建设
  • 邢台市做网站电话专业企业建站系统
  • 一个网站的百度反链多好还是少好网站设计步骤图片
  • 网站建设500元天津网站制作专业
  • 中国设计师个人网站免费网站模板源码下载
  • 建设银行网站图片大全企业网站seo数据
  • 深圳北斗部标平台网站建设青岛物流网站建设
  • 做直播导航网站站长统计软件
  • 建设网站怎么学只有网站才需要域名吗
  • 网站logo尺寸一般多大漳州市芗城区建设局网站