V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Vzx01
V2EX  ›  问与答

关于 spring security 的问题

  •  1
     
  •   Vzx01 · Jul 20, 2019 · 1106 views
    This topic created in 2473 days ago, the information mentioned may be changed or developed.

    几年前的 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 为空

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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3411 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:20 · PVG 20:20 · LAX 05:20 · JFK 08:20
    ♥ Do have faith in what you're doing.