【问题标题】:Symfony Iframe Logging Problem On Chrome With SameSite Cookies带有 SameSite Cookie 的 Chrome 上的 Symfony iframe 日志记录问题
【发布时间】:2020-07-01 08:38:03
【问题描述】:

我有 A 站点和 B 站点。都在 HTTPS 上,都在不同的域上。 一个站点运行 Symfony,我在其中准备了一个登录页面,我通过页面 B 上的 iframe 包含该页面。 日志记录过程在任何主要浏览器上都能正常工作,除了启用标志#same-site-by-default-cookies (chrome://flags/#same-site-by-default-cookies) 的 Chrome。如果我在 Chrome 上禁用此标志,它也可以正常工作。

有谁知道我可以做些什么来修复它?我可能需要将 Cookie 中的 SameSite 标志设置为“无”,但我不知道它涉及哪个 cookie 以及在哪里更改它。

我正在使用:

  • Symfony 4.4.2
  • friendsofsymfony/user-bundle 2.1.2
  • PHP 7.2

我的自白: 框架.yaml

framework:
secret: '%env(APP_SECRET)%'
translator: { fallbacks: [pl] }
form: { enabled: true }
validation: { enable_annotations: true }
default_locale: '%locale%'
csrf_protection: true

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
    handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler

#esi: true
fragments: ~
http_method_override: true
php_errors:
    log: true

security.yaml

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        switch_user:            true
        pattern: ^/
        context:            user
        remember_me:
            #key:      "%secret%"
            secret: "%secret%"
            lifetime: 31536000 # 365 days in seconds
            path:     /
            domain:   ~ # Defaults to the current domain from $_SERVER
            token_provider: Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider
        form_login:
            provider: fos_userbundle
            # csrf_token_generator: security.csrf.token_manager
            # if you are using Symfony < 2.8, use the following config instead:
            # csrf_provider: form.csrf_provider
            always_use_default_target_path: true
            default_target_path: /after-login
            success_handler: authentication_handler
            failure_handler: authentication_handler
        oauth:
            resource_owners:
                facebook:           "/loginSocial/check-facebook"
                google:             "/loginSocial/check-google"
            login_path:        /loginSocial
            use_forward:       false
            failure_path:      /loginSocial
            oauth_user_provider:
                service: fm_user_provider
            always_use_default_target_path: true
            default_target_path: /after-login
        logout:
            target: fmUserAfterLogout
            success_handler: logout_handler
        anonymous:    true

【问题讨论】:

  • 这里一样,需要解决方案。 Symfony 中的相同站点配置不起作用。

标签: symfony session cookies samesite


【解决方案1】:

framework.yaml

添加选项“cookie_samesite”

session:
    cookie_samesite: none

Symfony Doc

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-10
    • 2021-03-15
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 2011-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多