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

怎样做二维码链接到网站上建设部勘察设计网站

怎样做二维码链接到网站上,建设部勘察设计网站,做商城网站那个好,新建茶叶网站文章内容建设SpringSecurity6从入门到实战之SpringSecurity6自定义认证规则 Spring Security 中默认所有的 http 请求都需要先认证通过后#xff0c;才能访问。那么#xff0c; 如何指定不需要认证就可以直接访问的资源呢#xff1f;比如 用户的登录页面和注册页面#xff0c;都是不需要…SpringSecurity6从入门到实战之SpringSecurity6自定义认证规则 Spring Security 中默认所有的 http 请求都需要先认证通过后才能访问。那么 如何指定不需要认证就可以直接访问的资源呢比如 用户的登录页面和注册页面都是不需要认证就必须能被直接访问的。这就需要设置自定义的URL认证规则 SpringSecurity5.x自定义认证与6.x # 在 SpringSecurity5.x中 了解已被废弃 // 自定义配置类 继承 WebSecurityConfigurerAdapter 类覆盖 configure() 方法Configurationpublic class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {Overrideprotected void configure(HttpSecurity http) throws Exception {http.authorizeHttpRequests().mvcMatchers(/hello).permitAll().anyRequest().authenticated().and().formLogin();}} # 在 SpringSecurity6.x 中// 自定义配置类 使用注解 EnableWebSecurity 配置 SpringSecurity开发示例 创建一个新的controller /test package com.example.controller;import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;RestController public class HelloController {RequestMapping(/hello)public String hello() {System.out.println(/hello);return hello...;}RequestMapping(/test)public String test() {System.out.println(/test);return test...;} }方便与/hello对比进行测试 根据SpringSecurity6.x自定义认证规则配置 新建MyWeSecurityConfig自定义配置类 package com.example.config;import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.web.SecurityFilterChain;Configuration EnableWebSecurity public class MyWeSecurityConfig {Beanpublic SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {//放行hello和testhttp.authorizeHttpRequests().requestMatchers(/hello, test).permitAll()//所有请求都需要进行认证.anyRequest().authenticated()//进行表单登录验证.and().formLogin();return http.build();} }测试 结论 最终可以发现我们可以自定义认证规则,让例如注册等不需要认证的请求直接放行,让其他请求进行认证操作后再进行放行
http://www.hkea.cn/news/14451035/

相关文章:

  • 想做网站开发兼职wordpress管理员改为投稿者
  • wordpress添加站点新闻发布会是一种
  • 游戏点卡平台网站开发页面优化
  • 网站建设考试重点河南省工程建设业协会网站
  • dede网站模版免费商城系统源码
  • 平邑网站优化专门做兼职的网站有哪些
  • 网络营销对于个人而言有什么作用深圳做网站优化
  • 公司名称logo设计江门网站优化快速排名
  • 社区平安建设基层网站泰州网站建设电话
  • 如何创建游戏网站网页优化方案
  • 如何搭建公司内部网站网站建设淘宝客模板下载
  • 上海比较好的网站建设公司停止wordpress
  • 有网站开发专业吗网站建设网站网站建设网站
  • 电商网站建设的目标做网站的版式会侵权吗
  • wordpress 4.1 主题seo推广公司网站模板
  • 建设环保网站查询系统郑州注册公司流程及费用
  • 怎么健手机网站阿里云网站怎么备案域名解析
  • 淘宝上网站建设为啥这么便宜wordpress防止文章被采集
  • 做logo赚钱的网站公众号怎么建立
  • 佛山门户网站建设公司江西最新新闻事件
  • 什么是网站的功能模块工程监理行业为什么做网站
  • 校园文化网站建设莱芜在线论坛莱芜话题西关规划图
  • 集团网站推广哈尔滨一恒建设
  • 网站详情页链接怎么做wordpress忘记密码邮件收不到
  • 昆明seo博客南网站建设网站页面设计分析
  • 自适应 网站开发二次开发招聘
  • 义乌网站建设工作室高端网站制作公
  • 深圳高端做网站东莞便宜做网站
  • 深夜小网站网站建设流程 费用
  • 毕业设计论文网站开发需要多少wordpress 屏蔽搜索引擎