当前位置: 首页 > 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.ho-use.cn/article/10820930.html

相关文章:

  • 高端网站建设公司有哪些项目网站建设一般要多大空间
  • 网站seo推广计划销售网站的销量统计怎么做
  • 做衣服的教程网站有哪些全国装修公司排名100强
  • 建设维护网站 未签订合同wordpress中文企业主题下载
  • 用tomcat做网站目录wordpress 网站上传到服务器
  • 宣讲家网站生态文明建设福永做网站
  • vps网站目录显示灰色的上海建设工程 U盘登录哪个网站
  • 学做简单网站自媒体网站建设论文
  • 有没有可以做物理实验的网站18年手机网站
  • 怎么在国外网站买东西顺义区网站建设
  • 在哪里建设网站wordpress手机版安装
  • 常德网站制作贵州十大广告公司
  • wordpress 4.9 站群php网站开发工程
  • 车机油哪个网站做的好成都网站建站推广
  • 长沙建站模板大全天津网站定制公司
  • 下载网站源文件免费购物的软件
  • 网站建设如何开票怎么做系统网站
  • 网站制作公司报价正确的网线的顺序图
  • 空间站免费版下载东莞市阳光网
  • 一级a做爰片51网站怎么在自己网站上做拼图
  • 网站友情链接模块毕设如何做网站
  • 网站点击赚钱怎么做当地自己的淘宝网站怎么做
  • 一图读懂制作网站公司logo在线设计
  • 学生个人网页制作代码模板怀化优化网站排名
  • 北京商城网站建设报价网站托管流程
  • 购买建立网站费怎么做会计凭证seo搜索引擎优化实战
  • linux系统服务器怎么做网站上海今天死亡新闻
  • 网站建设费如何记账自己域名做网站
  • 营销网站建设文章全球最受欢迎的网站排名
  • 百度推广营销方案百度关键词优化大