我如何使用Spring Security没有会话? [英] How can I use Spring Security without sessions?

查看:300
本文介绍了我如何使用Spring Security没有会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个Web应用程序使用Spring Security,将生活在亚马逊EC2和使用Amazon的弹性负载平衡器。不幸的是,ELB不支持粘性会话,所以我要确保我的应用程序正常工作而不会。

I am building a web application with Spring Security that will live on Amazon EC2 and use Amazon's Elastic Load Balancers. Unfortunately, ELB does not support sticky sessions, so I need to ensure my application works properly without sessions.

到目前为止,我已经建立RememberMeServices的分配通过cookie令牌,这工作得很好,但我想该cookie与浏览器会话过期(浏览器关闭例如,当)。

So far, I have setup RememberMeServices to assign a token via a cookie, and this works fine, but I want the cookie to expire with the browser session (e.g. when the browser closes).

我也想像我不是第一个要使用Spring Security没有会议......有什么建议?

I have to imagine I'm not the first one to want to use Spring Security without sessions... any suggestions?

推荐答案

这似乎是更容易在春季Securitiy 3.0。如果你使用命名空间配置,你可以简单地做如下:

It seems to be even easier in Spring Securitiy 3.0. If you're using namespace configuration, you can simply do as follows:

<http create-session="never">
  <!-- config -->
</http>

或者你可以配置SecurityContextRepository为空,并没有什么会永远得救这样<一个href="http://static.springsource.org/spring-security/site/docs/3.0.x/reference/core-web-filters.html#security-context-repository">as还有。

这篇关于我如何使用Spring Security没有会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆