After some debugging, I understood that my user was disconnected from any route under a firewall where anonymous was set to false.
This is strange as it does not happen on my local computer and all was fine until now.
How to debug this further?
Please note I have specified the same context for my 2 firewalls, the publicone, and the other one where the issue happens.
My security.yml:
security:
# La valeur de « Strategy » peut être : affirmative, unanimous ou consensus
access_decision_manager:
strategy: unanimous
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
guest:
pattern: /(public/|$|genemu-captcha-refresh|media/cache/)
anonymous: true
context: main_auth
main:
http_basic: ~
pattern: ^/
anonymous: false
provider: main
context: main_auth
switch_user: { role: ROLE_ADMIN, parameter: _switch_user_parameter }
form_login:
login_path: fos_user_security_login
check_path: fos_user_security_check
success_handler: authentication_site_handler
logout:
path: fos_user_security_logout
target: /
remember_me:
key: "%secret%"
lifetime: 86400 #en secondes
path: /
domain: ~ # Prend la valeur par défaut du domaine courant depuis $_SERVER
oauth:
remember_me: true
resource_owners:
facebook: "/loginhwi/check-facebook"
github: "/loginhwi/check-github"
google: "/loginhwi/check-google"
twitter: "/loginhwi/check-twitter"
linkedin: "/loginhwi/check-linkedin"
flickr: "/loginhwi/check-flickr"
login_path: fos_user_security_login
check_path: fos_user_security_check
failure_path: fos_user_security_login
success_handler: authentication_site_handler
oauth_user_provider:
service: fosubuser.provider
providers:
main:
id: fos_user.user_provider.username_email
encoders:
AppBundle\Entity\User\User: sha512
#Role hierarchy is now managed from the database
# role_hierarchy:
# ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] #Allowed full access
access_control:
- { path: ^/admin, ip: 127.0.0.1, requires_channel: http, roles: ROLE_SUPER_ADMIN }
- { path: ^/ , roles: IS_AUTHENTICATED_ANONYMOUSLY}
OK, the error came from
http_basic: ~
in the main firewall. I don't recall why I put it but removing it solved the issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.