Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 错误页面重定向后,Spring安全身份验证为空_Java_Spring_Spring Mvc_Spring Security_Error Handling - Fatal编程技术网

Java 错误页面重定向后,Spring安全身份验证为空

Java 错误页面重定向后,Spring安全身份验证为空,java,spring,spring-mvc,spring-security,error-handling,Java,Spring,Spring Mvc,Spring Security,Error Handling,一些背景 当我试图构建一个包含用户信息和角色访问的导航栏时,我遇到了一些问题,无法从处理程序拦截器上的身份验证(Spring Security)中检索404错误页面上的这些信息 @组件 公共类AuthenticationHandlerInterceptor实现HandlerInterceptor{ @自动连线 私有IAAuthenticationFacade authenticationFacade; @凌驾 公共布尔预处理(HttpServletRequest请求、HttpServletRes

一些背景

当我试图构建一个包含用户信息和角色访问的导航栏时,我遇到了一些问题,无法从处理程序拦截器上的身份验证(Spring Security)中检索404错误页面上的这些信息

@组件
公共类AuthenticationHandlerInterceptor实现HandlerInterceptor{
@自动连线
私有IAAuthenticationFacade authenticationFacade;
@凌驾
公共布尔预处理(HttpServletRequest请求、HttpServletResponse响应、对象处理程序)引发异常{
返回true;
}
@凌驾
public void postHandle(HttpServletRequest请求、HttpServletResponse响应、对象处理程序、,
ModelAndView(ModelAndView)引发异常{
if(modelAndView!=null){

Authentication Authentication=authenticationFacade.getAuthentication();//如果您想获得经过身份验证的客户,请尝试
@AuthenticationPrincipal
注释。

您的确切意思是什么?在ErrorController、ServerPropertiesConfig或AuthenticationHandlerInterceptor上?
Authentication authentication = authenticationFacade.getAuthentication();