gpt4 book ai didi

session - symfony2 session 自动启动

转载 作者:行者123 更新时间:2023-12-02 05:29:42 25 4
gpt4 key购买 nike

我想在之前执行登录时开始 session 。

我发现,当我在我的表单中使用它时,csrf token 也会启动一个 session 。

现在我禁用了 csrf token ,但系统也启动了一个 session 。

symfony2 的哪些部分也在创建 session ?

我如何使用 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

最佳答案

在您的公共(public)防火墙中,禁用匿名身份验证,因为它需要 session 来识别未登录的用户。

您可以替换为:

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

关于session - symfony2 session 自动启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12578653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com