WebSecurity

news/2025/2/22 16:04:27/

WebSecurity

此类是由配置类WebSecurityConfiguration创建,为了创建FilterChainProxy,称为Spring安全过滤器链。springSecurityFilterChain是DelegatingFilterProxy所委托的过滤器。对WebSecurity的自定义可以通过创建WebSecurityConfigurer来完成,或者更可能通过重写WebSecurityConfigurerAdapter来完成。

ignoring

	public IgnoredRequestConfigurer ignoring() {return ignoredRequestRegistry;}

返回IgnoredRequestConfigurer,是一个内部类

通常注册的请求只能是静态资源的请求。对于动态请求,考虑将请求映射为允许所有用户。也即是允许添加可以忽略的静态资源,可以允许所有的动态请求访问。

webSecurityBuilder.ignoring()..antMatchers("/resources/**","/static/**");
webSecurityBuilder.ignoring()..antMatchers("/resources/**").antMatchers("/static/**");
webSecurityBuilder.ignoring()..antMatchers("/resources/**") ;webSecurityBuilder.ignoring()..antMatchers("/static/**");
三者效果相同

httpFirewall

允许自定义HttpFirewall。默认为StrictHttpFirewall。

debug

	public WebSecurity debug(boolean debugEnabled) {this.debugEnabled = debugEnabled;return this;}

控制Spring Security的调试支持。debugEnabled为true时,允许debug支持。默认为false。

addSecurityFilterChainBuilder

	public WebSecurity addSecurityFilterChainBuilder(SecurityBuilder<? extends SecurityFilterChain> securityFilterChainBuilder) {this.securityFilterChainBuilders.add(securityFilterChainBuilder);return this;}

增加SecurityFilterChain。通常,该方法会在框架内从WebSecurityConfigurerAdapter#init(WebSecurity)自动调用。

privilegeEvaluator

	public WebSecurity privilegeEvaluator(WebInvocationPrivilegeEvaluator privilegeEvaluator) {this.privilegeEvaluator = privilegeEvaluator;return this;}

设置要使用的WebInvocationPrivilegeEvaluator。如果未指定此参数,则当securityInterceptor(FilterSecurityInterceptor)非空时将创建DefaultWebInvocationPrivilegeEvaluator
此方法是为了进一步定制。

expressionHandler

	public WebSecurity expressionHandler(SecurityExpressionHandler<FilterInvocation> expressionHandler) {Assert.notNull(expressionHandler, "expressionHandler cannot be null");this.expressionHandler = expressionHandler;return this;}

设置使用的SecurityExpressionHandler。如果未指定此参数,默认为DefaultWebSecurityExpressionHandler

securityInterceptor

	public WebSecurity securityInterceptor(FilterSecurityInterceptor securityInterceptor) {this.filterSecurityInterceptor = securityInterceptor;return this;}

设置FilterSecurityInterceptor。这通常由WebSecurityConfigurerAdapter调用。此方法是为了进一步定制。

postBuildAction

	public WebSecurity postBuildAction(Runnable postBuildAction) {this.postBuildAction = postBuildAction;return this;}

在生成发生后立即执行Runnable

setApplicationContext

	public void setApplicationContext(ApplicationContext applicationContext)throws BeansException {this.defaultWebSecurityExpressionHandler.setApplicationContext(applicationContext);try {this.defaultWebSecurityExpressionHandler.setRoleHierarchy(applicationContext.getBean(RoleHierarchy.class));} catch (NoSuchBeanDefinitionException e) {}try {this.defaultWebSecurityExpressionHandler.setPermissionEvaluator(applicationContext.getBean(PermissionEvaluator.class));} catch(NoSuchBeanDefinitionException e) {}this.ignoredRequestRegistry = new IgnoredRequestConfigurer(applicationContext);try {this.httpFirewall = applicationContext.getBean(HttpFirewall.class);} catch(NoSuchBeanDefinitionException e) {}}

这个方法继承自ApplicationContextAware接口。
设置运行此对象的ApplicationContext。通常这个调用将用于初始化对象。
在填充普通bean属性之后,在初始化回调(如org.springframework.beans.factory.InitializingBean#afterPropertiesSet())或自定义init-method之前调用。


http://www.ppmy.cn/news/559461.html

相关文章

JetBrains WebStorm 2022.2 Crack

WebStorm 为您提供 Javascript 和编译到 Javascript 语言、Node.js、HTML 和 CSS 的智能编码帮助。享受所有这些语言的代码完成、强大的导航功能、即时错误检测和重构。 WebStorm 是 JavaScript 和相关技术的集成开发环境。与其他 JetBrains IDE 一样&#xff0c;它使您的开发体…

管理员后台爆破扫描器-WebCrack

本文来源我在某大佬博客上看到的一篇扫描器webcrack&#xff0c;它支持如discuz&#xff0c;织梦&#xff0c;phpmyadmin等主流CMS&#xff0c;自己下来玩了一下 环境&#xff1a; 下载github项目 git clone https://github.com/yzddmr6/WebCrack依赖 pip install -r requir…

iPhone/iPad使用A-Shell免越狱运行SQLmap等渗透工具【持续更新】【A-Shell使用】【渗透工具】【待完善】

【最后一次更新:2023.​​4.08】 请勿利用文章内的相关技术从事非法测试&#xff0c;由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失&#xff0c;均由使用者本人负责&#xff0c;作者不为此承担任何责任&#xff5e; 这是国内第一篇原创有关A-Shell的文章…

[WRECKCTF 2022] crypto,reverse,pwn部分WP

国庆两天&#xff0c;一个比较容易的比赛。会的题不少。感觉到自信了。 目录 国庆两天&#xff0c;一个比较容易的比赛。会的题不少。感觉到自信了。 crypto spin baby-rsa mtp prime token rsa lsfr reverse flag-chcker adwanced-flag-checker my-frob reverse…

InternetCrackUrl

InternetCrackUrl函数是把一个URL填充到URL_COMPONENTS结构中, 那返回的是0&#xff0c;是什么意思了&#xff1f;能指点一下吗&#xff1f; InternetCrackUrl函数是把一个URL填充到URL_COMPONENTS结构中。 不是下载用的。

Web-crawler

导航 (返回顶部) 1. spider 1.1 robots.txt1.2 ads.txt1.3 security.txt1.4 blogger.com 上的 robots.txt和ads.txt2. 爬虫软件列表 2.1 介绍一些比较方便好用的爬虫工具和服务2.2 33款可用来抓数据的开源爬虫软件工具(全都没试过)3. 更多相关 1. spider1.1 robots.txt1.2 ads.…

WebCrack:网站后台弱口令批量检测工具 ——yzddMr6

经过这么长时间的测试终于算是可以上线了&#xff0c;写篇文章跟大家分享一下自己的开发思路吧 注&#xff1a;本工具借鉴吸收了TideSec的web_pwd_common_crack很多优秀的思路&#xff0c;在此基础上增加了很多拓展功能使其更加强大&#xff0c;在这里给TideSec的大佬点个赞&am…

弱口令(Weak Password)总结和爆破工具

文章目录 弱口令定义弱口令字典通过社工定制字典库弱口令字典 爆破工具超级弱口令检查工具水影-域信息收集WebCrackBurpSuite的intruder模块hydra 弱口令定义 网站管理、运营人员由于安全意识不足&#xff0c;为了方便、避免忘记密码等&#xff0c;使用了非常容易记住的密码&a…