使用Google App Engine在Spring Boot应用程序中设置会话超时

时间:2019-04-23 10:39:02

标签: spring-boot google-app-engine session-management

我有一个正在安装在Google App Engine中的Spring Boot应用程序。 我需要根据条件设置会话超时。

我尝试在spring安全配置中以

的形式附加一个successHandler
 protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
            .and()
            .successHandler(successHandler())

    }

这是成功处理程序

    private AuthenticationSuccessHandler successHandler() {
    return (httpServletRequest, httpServletResponse, authentication) -> {
        httpServletRequest.getSession().setMaxInactiveInterval(10);
    };
}

我发现Google App Engine使用码头服务器(实际上是码头9),并且 它经常将创建的会话存储在Memcache和数据存储区中。 应用引擎如何不遵守通过调用

设置的会话超时的一些方法
httpServletRequest.getSession().setMaxInactiveInterval(10);

0 个答案:

没有答案
相关问题