我已经实现了一个自定义AbstractPreAuthenticatedProcessingFilter,它在方法中返回一个Principal(实际上是Object根据签名)getPreAuthenticatedPrincipal(HttpServletRequest)。
我正在自定义实现一个UserDetailsService需要以Principal某种方式访问的。我尝试过使用SecurityContextHolder.getContext().getAuthentication().getPrincipal(),它抛出了一个NullPointerException因为getAuthentication()是空的。
我如何访问Principal其他?