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

外贸类网站模板最近火爆的新闻大事

外贸类网站模板,最近火爆的新闻大事,网站后台中表格制作,全屏式网站文章目录 1、用户认证流程AuthenticationSuccessHandler AuthenticationFailureHandlerSecurityFilterChain配置用户认证信息 2、会话并发处理2.1、实现处理器接口2.2、SecurityFilterChain配置 1、用户认证流程 AuthenticationSuccessHandler AuthenticationFailureHandler … 文章目录 1、用户认证流程AuthenticationSuccessHandler AuthenticationFailureHandlerSecurityFilterChain配置用户认证信息 2、会话并发处理2.1、实现处理器接口2.2、SecurityFilterChain配置 1、用户认证流程 AuthenticationSuccessHandler AuthenticationFailureHandler 登录成功后调用AuthenticationSuccessHandler登录失败后调用AuthenticationFailureHandler public class SecurityAuthenticationSuccessHandler implements AuthenticationSuccessHandler {Overridepublic void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {//获取用户身份信息Object principal authentication.getPrincipal();//创建结果对象HashMap result new HashMap();result.put(code, 0);result.put(message, 登录成功);result.put(data, principal);//转换成json字符串String json JSON.toJSONString(result);//返回响应response.setContentType(application/json;charsetUTF-8);response.getWriter().println(json);} } SecurityFilterChain配置 form.successHandler(new SecurityAuthenticationSuccessHandler()) //认证成功时的处理用户认证信息 RestController public class IndexController {GetMapping(/)public Map index(){System.out.println(index controller);SecurityContext context SecurityContextHolder.getContext();//存储认证对象的上下文Authentication authentication context.getAuthentication();//认证对象String username authentication.getName();//用户名Object principal authentication.getPrincipal();//身份Object credentials authentication.getCredentials();//凭证(脱敏)Collection? extends GrantedAuthority authorities authentication.getAuthorities();//权限System.out.println(username);System.out.println(principal);System.out.println(credentials);System.out.println(authorities);//创建结果对象HashMap result new HashMap();result.put(code, 0);result.put(data, username);return result;} }2、会话并发处理 后登录的账号会使先登录的账号失效 2.1、实现处理器接口 实现接口SessionInformationExpiredStrategy package com.atguigu.securitydemo.config;public class MySessionInformationExpiredStrategy implements SessionInformationExpiredStrategy {Overridepublic void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException, ServletException {//创建结果对象HashMap result new HashMap();result.put(code, -1);result.put(message, 该账号已从其他设备登录);//转换成json字符串String json JSON.toJSONString(result);HttpServletResponse response event.getResponse();//返回响应response.setContentType(application/json;charsetUTF-8);response.getWriter().println(json);} }2.2、SecurityFilterChain配置 //会话管理 http.sessionManagement(session - {session.maximumSessions(1).expiredSessionStrategy(new MySessionInformationExpiredStrategy()); });
http://www.dnsts.com.cn/news/51136.html

相关文章:

  • 做企业展示网站做房产网站接不到电话
  • 江西网站建设公司费用虚拟主机多个网站
  • 大学生网站制作作业免费下载网站设计网站维护
  • 在网上做效果图赚钱的网站html底部的版权代码
  • 西安最好的网站建设公司wordpress dewplayer
  • 南海网站建设公司温岭手机网站建设
  • 微信小程序开发教程官方文档北京网站建设乐云seo
  • 西安建设公司网站娄底建设网站的公司
  • 佛山外贸网站建站东莞网站建设团队全网天下
  • 建设科技期刊官网seo关键词推广优化
  • vs2008怎么做网站西双版纳傣族自治州民宿
  • wdcp搭建网站网站后台文件下载
  • wordpress 培训插件网站做好后怎么做seo
  • html网站地图模板网站内容有哪些
  • wordpress收录前端页面插件怎么做公司网站seo
  • 弓长岭网站建设开发商排名
  • 一级a做网站免费做装修的有那些网站
  • 网站后缀有哪些奇客影院wordpress
  • 自己做电影网站需要什么上海正规做网站公司报价
  • wordpress打开网站前动画企业网站建设网站模板
  • 网站开发语言市场有率痞子wordpress模板
  • 个人网站自助建站wordpress get_terms 排序
  • 酒店找人做网站十大全屋整装公司排名
  • 企业网站货物查询怎么做parallax wordpress
  • 用dw做的网站怎么发布网页设计实验总结与体会
  • 大学什么专业是学网站开发的九江有哪些免费推广网站
  • 重庆网站seo教程dtcms网站开发教程
  • 辽宁网站建设论坛做网站免费吗
  • 网站服务器维护 价目表餐饮企业网站建设方案书
  • 做ui的网站有哪些内容wordpress绕绕