c3stones / blog Goto Github PK
View Code? Open in Web Editor NEW博客练习Demo工程
博客练习Demo工程
你好!~
在参照你的配置,配置springSecurity的时候我发现你在/src/main/java/com/c3stones/security/config/SysSecurityConfig.java中配置自定义未认证处理类的时候是这样写的:
http.authorizeRequests() // 权限配置
.antMatchers(JWTConfig.antMatchers.split(",")).permitAll()// 获取白名单(不进行权限验证)
.anyRequest().authenticated() // 其他的需要登陆后才能访问
.and().httpBasic().authenticationEntryPoint(userNotLoginHandler) // 配置未登录处理类
......
参照你的配置我定义了处理类,在postman中发送请求得到的结果是正确的(自定义json),但是在浏览器中直接访问却发生了重定向(断点都没有进入),在反复确认和debug以及查找问题后发现未认证处理类和权限不足的处理类配置应当是这样:
http.exceptionHandling().accessDeniedHandler(userAccessDeniedHandler)// 配置没有权限处理类
.authenticationEntryPoint(userNotLoginHandler) // 配置未登录处理类
再次测试结果正确,想请教下为什么postman和浏览器的结果存在差异,以及po主踩了这个坑嘛~~,希望能得到你的回复~~
来自博客:https://www.cnblogs.com/cao-lei/p/13298394.html
源码仓库:https://github.com/C3Stones/blog/tree/master/spring-security-jwt-demo
为什么在JWTConfig.java下提示未配置Spring boot配置注解处理器
Set<GrantedAuthority> authorities = new HashSet<>(); // 角色集合
请问这里为什么是角色集合?????我理解是当前用户的权限集合。
请问可以解释一下吗??
hi i am newer to springboot and weblogic
i try to deploy the spring-boot-weblogic-demo project to weblogic 12c ( docker pull ismaleiva90/weblogic12)
when i try to deploy, below errors :
错误 无法访问所选应用程序。 错误 java.io.IOException 错误 weblogic.utils.compiler.ToolFailureException
can you help to solve this problem
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.