我在登录后使用fosuserbundle有重定向循环
怎么样?我键入了良好的用户名和密码,然后登录我,我可以用symfony profiller看到它
并且分析器说This request redirects to http://web.dev/app_dev.php/admin/panel.
我去了那里,它说This request redirects to http://web.dev/app_dev.php/admin/login.
并且我不再在这个地方进行身份验证
这是我的安全:
jms_security_extra:
expressions: true
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
MainBundle\Security\User\SsoUser: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
"%api_username%": { password: "%api_password%", roles: [ 'ROLE_API' ] }
fos_userbundle:
id: fos_user.user_provider.username_email
ssoprovider:
id: sso_user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/demo/secured/login$
security: false
admin:
pattern: ^/admin/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
login_path: fos_user_security_login
check_path: fos_user_security_check
default_target_path: admin_main
logout:
path: fos_user_security_logout
invalidate_session: true #https://github.com/symfony/symfony/issues/5868
anonymous: true
remember_me:
name: "web_remember_me"
key: "%secret%"
lifetime: 864000 # 10 days
path: /admin
secured_area:
pattern: ^/(?!admin)
form_login:
login_path : main_user_logout
stateless: false
anonymous: false
simple_preauth:
authenticator: sso_authenticator
logout:
path: main_user_logout
invalidate_session: true
success_handler: sso_authentication_handler
api:
pattern: ^/api
stateless: true
http_basic:
realm: "Secured API Area"
access_control:
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
- { path: ^/api/, roles: ROLE_API }
- { path: ^/, role: ROLE_USER }
答案 0 :(得分:0)
这是因为我在config.yml cookie_domain
config yml:
framework:
session:
cookie_domain: .%domain%
我必须添加以便记住我domain
配置
security.yml:
admin:
remember_me:
domain: ".%domain%"