加载中...
加载中...
Spring Security异常处理

Spring Security异常处理 原创

Spring security 官方文档
8.2.1. AuthenticationEntryPoint
AuthenticationEntryPoint会被调用, 在用户请求一个安全HTTP资源,但是他们还没有被认证。一个对应的 AuthenticationException或 AccessDeniedException会被抛出, 由一个安全监听器在下面的调用栈中,触发入口点的 commence方法。这执行展示对应的响应给用户, 这样认证可以开始。我们这里使用的是 LoginUrlAuthenticationEntryPoint,它会把请求 重定向到另一个不同的URL(一般是一个登陆页面)。实际的使用使用会依赖 你希望使用到的认证机制。  

异常 异常类
账号状态异常 AccountStatusException
账号锁定状态 LockedException
账号禁用状态 DisabledException
账户过期状态 AccountExpiredException
证书过期状态 CredentialsExpiredException
凭证无效 BadCredentialsException
用户不存在 UsernameNotFoundException
认证信息不足 InsufficientAuthenticationException
需要AccessToken AccessTokenRequiredException
UnapprovedClientAuthenticationException
认证服务端异常 AuthenticationServiceException
InternalAuthenticationServiceException
记住我错误 RememberMeAuthenticationException
CookieTheftException
Cookie无效 InvalidCookieException
其他 SessionAuthenticationException
PreAuthenticatedCredentialsNotFoundException
Provider未查找到 ProviderNotFoundException
AuthenticationCredentialsNotFoundException
Nonce已经过期/超时 NonceExpiredException
鉴权异常:认证用户访问无权限资源时的异常为AccessDeniedException, 可以自定义AccessDeniedHandler进行处理  


一、SpringBootTest介绍SpringTest与JUnit等其他测试框架结合起来,提供了便捷高效的测试手段。而SpringBootTest是在SpringTest之上的再次封装,增加了切片测试,增强了mo
没有更多推荐了 [去首页]
image
文章
376
原创
293
转载
83
翻译
0
访问量
183411
喜欢
73
粉丝
5
码龄
7年
资源
3

文章目录

加载中...
0
0