2012-09-25 47 views
2

我想開始會話時執行登錄不是以前。symfony2會話auto_start

我發現,那德CSRF令牌也將啓動一個會話,當我在我的形式使用。

現在我禁用了CSRF令牌,但該系統也將啓動一個會話。

Symfony2中的哪些部分是創建會話嗎?

我怎樣才能檢測到正確的黨在我與Xdebug的應用程序? 我把斷點放在Session.class中,但是xdebug在這一點上永遠不會停下來。

非常感謝。

我正在使用symfony 2.0。

這是我config.yml部分

session: 
    default_locale: %locale% 
    lifetime: %session_lifetime%   
    path:/
    domain: %session_authdomain%    
    name: sid 
    auto_start: false 

這是我security.yml

security: 
encoders:   
    Danke\ForumBundle\Entity\Forumuser: sha512 
    Danke\ForumBundle\Entity\Admin: sha512 

role_hierarchy: 
    ROLE_MODERATOR: [ROLE_MANAGE_DEAL, ROLE_MANAGE_COMMENT] 
    ROLE_ADMIN: [ROLE_MODERATOR, ROLE_MANAGE_CATEGORY, ROLE_MANAGE_AFFILIATELINK, ROLE_MANAGE_FORUMUSER, ROLE_MANAGE_BADLINK, ROLE_MANAGE_BADWORD] 
    ROLE_SUPERADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH, ROLE_MANAGE_EXCLUSIVEDEAL, ROLE_MANAGE_ADMIN] 

providers: 
    forumuser: 
     providers: u_email, u_username 
    u_email: 
     entity: { class: Danke\ForumBundle\Entity\Forumuser, property: email } 
    u_username: 
     entity: { class: Danke\ForumBundle\Entity\Forumuser, property: username } 
    admin: 
     providers: a_email, a_username 
    a_email: 
     entity: { class: Danke\ForumBundle\Entity\Admin, property: email } 
    a_username: 
     entity: { class: Danke\ForumBundle\Entity\Admin, property: username } 


firewalls: 
    dev: 
     pattern: ^/(_(profiler|wdt)|css|images|js)/ 
     security: false 

    admin: 
     # since anonymous is allowed users will not be forced to login 
     pattern: /admin/ 
     form_login: 
     provider: admin 
     login_path: /admin 
     check_path: /admin/login 
     always_use_default_target_path: true 
     default_target_path: /admin/deal 
     anonymous: false 
     logout: 
      path: /admin/logout 
      target: /admin 

    public: 
     # since anonymous is allowed users will not be forced to login 
     pattern: ^/.*   
     form_login: 
     provider: forumuser 
     login_path: /login 
     check_path: /login_check/form 
     #default_target_path: has to be declard in AuthenticationHandler 
     success_handler: danke.forum.listener.authenticationhandler 
     failure_handler: danke.forum.listener.authenticationhandler 
     anonymous: true 
     logout: true 

access_control: 
    //some access Control pages 
+0

你能展現security.yml文件?防火牆部分.. – AlterPHP

+0

我發佈了security.yml –

回答

5

在你的公開防火牆的,因爲它需要會話識別非登錄用戶禁用匿名身份驗證。

您可以通過替換:

firewalls: 
    public: 
     # since anonymous is allowed users will not be forced to login 
     pattern: ^/.* 
     security: false