Vzx01
V2EX  ›  问与答

关于 spring security 的问题

  •  1
     
  •   Vzx01 · Jul 20, 2019 · 1166 views
    This topic created in 2498 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   ·   3051 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 02:41 · PVG 10:41 · LAX 19:41 · JFK 22:41
    ♥ Do have faith in what you're doing.