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

关于 spring security 的问题

  •  1
     
  •   Vzx01 · 2019 年 7 月 20 日 · 1004 次点击
    这是一个创建于 2383 天前的主题,其中的信息可能已经有所发展或是发生改变。

    几年前的 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   ·   Solana   ·   3753 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 10:22 · PVG 18:22 · LAX 02:22 · JFK 05:22
    ♥ Do have faith in what you're doing.