Symfony 2.1 跨子域安全 [英] Symfony 2.1 Security Cross Subdomain

查看:32
本文介绍了Symfony 2.1 跨子域安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序上运行 Symfony 2.1,我们有不同的代码沙箱.例如.

Running Symfony 2.1 on an application and we have different sandboxes of the code. Eg.

  • aequasi.someurl.com
  • dev.someurl.com
  • hotcarl.someurl.com

我似乎不知道为什么,但是当我登录到 aequasi 并转到 hotcarl 时,我需要再次登录.当我这样做时,它会将我从 aequasi 中注销.

I cant seem to figure out why, but when im logged into aequasi, and i go to hotcarl, i need to log in again. When i do, it logs me out of aequasi.

所有沙箱都使用相同的数据库进行身份验证

All sandboxes are using the same database for auth

我的 config.yml 中有这个:

framework:
    session:
        cookie_domain: .someurl.com
        domain:        .someurl.com

我也将 php.ini 设置为使用相同的 url

ive got the php.ini set up to use the same url too

同样,session_id 也是一样的

also, the session_id's are the same

推荐答案

使用数据库或内存作为会话存储.这允许您在三个不同的 symfony 应用程序(每个都有自己的沙箱)之间共享会话数据.这将消除应用程序缓存之间的不一致,并允许您使用 *.domain.com 类型的 cookie.

Use a database, or memory as the Session storage. This allows you to share session data across three different symfony applications (each with their own sandbox). This will remove the inconsistencies between application caches and allow you to use a *.domain.com type cookie.

Symfony2 为替代会话存储提供了多个驱动程序.

Symfony2 provides several drivers for alternative session storage.

http://symfony.com/doc/current/components/http_foundation/session_configuration.html#custom-save-handlers

这篇关于Symfony 2.1 跨子域安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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