securesocial虚假登录开发时

Jor*_*ens 5 playframework-2.0 securesocial

我正在使用securesocial它工作正常但现在每次我更改一些scala代码我必须再次登录.在开发模式下是否有可能在会话中伪造用户,所以我不必经常登录?

谢谢,

Joris Wijlens

Dav*_*erg 12

默认情况下,SecureSocial使用默认播放缓存来存储验证器(将cookie与登录用户的cookie匹配).默认播放缓存是EHCache,它使用您可以在jar中找到的ehcache.xml进行配置.默认配置严格在内存中,这意味着当应用程序重新启动时,它会丢失所有值.幸运的是,覆盖EHCache配置以写入磁盘非常容易.

将jar中的ehcache.xml复制到配置目录.添加<diskStore path="java.io.tmpdir"/>并更改diskPersistenttrue

所以我看起来像这样:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<diskStore path="java.io.tmpdir"/>
<defaultCache
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="false"
        maxElementsOnDisk="10000000"
        diskPersistent="true"
        diskExpiryThreadIntervalSeconds="120"
        memoryStoreEvictionPolicy="LRU"
        />
</ehcache>
Run Code Online (Sandbox Code Playgroud)

如果您有兴趣学习如何配置其余部分,那么ehcache-failsafe.xml文件中的一些文档也在Play jar中.


Jor*_*rge -2

发生这种情况是因为在 DEV 模式下,当您更改代码时 Play 会重新启动应用程序。因此,示例用户服务中的数据会丢失。