Spring Session with Spring Session:如何禁止更新特定请求的会话上次访问时间

时间:2016-12-27 10:36:05

标签: spring spring-security spring-session

我想要做的是将/my-path上的请求排除在Spring Security的任何检查之外。问题是我有一条路径/my-path。对此路径的请求不应更新Spring Session中的上次访问时间。 请求的传递方式是SecurityContextPersistenceFilter,其中过滤器通过SecurityContextRepository加载上下文。 SecurityContextRepository获取会话,更新上次访问的时间。 所以问题是:是否可以从/my-path中排除任何会话检查的请求?

1 个答案:

答案 0 :(得分:1)

<http pattern="/my-path" security="none"/>

或Java配置

web.ignoring().antMatchers("/my-path");