V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Vzx01
V2EX  ›  问与答

关于 spring security 的问题

  •  
  •   Vzx01 · 2019-07-20 17:21:07 +08:00 · 684 次点击
    这是一个创建于 1713 天前的主题,其中的信息可能已经有所发展或是发生改变。

    几年前的 Javaweb 工程,改 bug, 我在 web.xml 加了一个 Itemfilter,位置在 securityFilter 的后面

    <filter>
      <filter-name>securityFilter</filter-name>
      <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
      <init-param>
        <param-name>targetClass</param-name>
        <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
      </init-param>
    </filter>
    

    然后我在 Itemfilter 里写

    SecurityContext securityContext = SecurityContextHolder.getContext();// 不为空 Authentication auth = securityContext.getAuthentication() // auth 为空

    请问这个怎么才能获取不为空? 万分感谢!

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1033 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:27 · PVG 06:27 · LAX 15:27 · JFK 18:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.