spring - 如何在春季启动中的 OAuth2AuthenticationProcessingFilter 末尾添加自定义安全过滤器?
问题描述
我想在 oauth2authentication 处理过滤器之后添加自定义过滤器,用于进行一些自定义身份验证。我该怎么做?我的资源服务器类如下:
@EnableResourceServer
@EnableWebSecurity
@Configuration
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/agent/**").access("#oauth2.hasScope('Chatagent-message')")
.anyRequest().authenticated()
.and().csrf().disable();
}
}
解决方案
推荐阅读
- php - 用functions.php删除cagefs/tmp折叠文件
- javascript - 如何在 js 中使用带有 async/await 和 for 循环的 Promise
- maven - 无法在 Android Studio 中为 Maven 加载类
- c# - 写入大字符串时streamWriter.Write挂起,但API操作成功完成
- git - 目录树更改时的 Git rebase 冲突
- web3-java - 以编程方式交换代币的方法是什么?
- r - 迭代 group_by()、summarise() 和基于 df 名称的唯一输出名称的最佳方法是什么?
- perl - 运行、保存变量状态、中断执行以及从中断前的最后一个状态重新加载变量
- python - 错误说明“min() arg 是一个空序列”
- google-sheets - 谷歌表格公式将我的 { 转换为 %7D 和 %7B