![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring Security
C_纯属虚构
这个作者很懒,什么都没留下…
展开
-
springboot整合spring security时出现的一个bug
一、问题描述:使用springboot整合spring security时出现的一个映射冲突。错误信息:Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'personServiceImpl': Unsatisfied dependency expressed through field 'personDao'; nested excepti原创 2021-03-20 11:49:35 · 281 阅读 · 0 评论 -
axios跨域请求之credentials
问题描述:在使用Spring Security时,实现前后端分离出现跨域问题,在Controller添加了跨域注解@CrossOrigin,但是登录成功后没有权限访问想要的接口,在没有前后端分离的情况下是可以正常访问,后来查阅资料发现默认情况下,标准的跨域请求是不会发送cookie等用户认证凭据的。所以服务器就默认你是没有登录的,不具备访问权限的。解决办法:1、前段请求 设置:在axios请求是设置参数: axios({ method:'get', url:`$原创 2020-11-28 13:17:11 · 2119 阅读 · 0 评论 -
Spring Security登录成功后,用户信息保存在哪,如何获取?
当前用户获取信息我们在SecurityContextHolder内存储目前与应用程序交互的主要细节。Spring Security使用一个Authentication对象来表示这些信息。 你通常不需要创建一个自我认证的对象,但它是很常见的用户查询的Authentication对象。你可以使用以下代码块-从你的应用程序的任何部分-获得当前身份验证的用户的名称,例如:获取登录用户信息Authentication authentication = SecurityContextHolder.getCont原创 2020-11-28 13:01:27 · 12991 阅读 · 7 评论