php - How to debug (and fix) Symfony2|3 routes? -


i have routes defined @ app/config/routing.yml in symfony 2.8 app:

platform_chat:     resource: "@platformchatbundle/controller/"     type:     annotation     prefix:   /chat  platform_admin:     resource: "@platformadminbundle/controller/"     type:     annotation     prefix:   /admin  #----> part of routing.yml forgot add easy_admin_bundle:     resource: "@platformadminbundle/controller/admincontroller.php"     type:     annotation     prefix:   /admin  #fosuser fos_user:     resource: "@fosuserbundle/resources/config/routing/all.xml" 

as may notice platformadminbundle backend , platformchatbundle frontend. having in mind tryin setuo , use 1 firewall both , on security.interactive_login event redirect right route|path. how firewall looks like:

security:     ...     role_hierarchy:         role_chatter:     role_user         role_admin:       role_user         role_super_admin: role_admin     ...     firewalls:         ...         ignored:             pattern: ^/(login(_check)?|logout|resetting)$             security: false         global:             pattern: ^/admin/(.*)|^/chat/(.*)             provider: fos_userbundle             form_login:                 csrf_provider: security.csrf.token_manager                 login_path: fos_user_security_login                 check_path: fos_user_security_check                 # if true, forward user login form instead of redirecting                 use_forward: true                 # login success redirecting options (read further below)                 always_use_default_target_path: true                 default_target_path: /admin                 target_path_parameter: _target_path                 use_referer: true                 remember_me: true             logout: ~             remember_me:                 secret:   '%secret%'                 lifetime: 604800 # 1 week in seconds                 path:     /      access_control:         - { path: ^/chat/, role: role_chatter }         - { path: ^/admin/, role: role_admin } 

but it's not working because when try login either user end error:

you must configure check path handled firewall using form_login in security firewall configuration.

which makes me think routes or firewall aren't configured. have checked routes under debug toolbar , none matches wrong complete. have read docs here it's not helpful @ , not getting fix problem. can take post second part of this one don't want change topic of old 1 , neither content because think helpful on future else. so, advice guys? debug kind of issues related routes? fix particular problem? stuck here!

update

i have made changes @xabbuh suggested app/config/routing.yml looks like:

platform_chat:     resource: "@platformchatbundle/controller/"     type:     annotation     prefix:   /chat     options:             expose: true  platform_admin:     resource: "@platformadminbundle/controller/"     type:     annotation     prefix:   /admin     options:         expose: true  #easyadminbundle easy_admin_bundle:     resource: "@platformadminbundle/controller/admincontroller.php"     type:     annotation     prefix:   /admin     options:         expose: true  #fosuser fos_user:     resource: "@fosuserbundle/resources/config/routing/all.xml"  #fosuser groups fos_user_group:     resource: "@fosuserbundle/resources/config/routing/group.xml"     prefix: /group  #fosjsrouting fos_js_routing:     resource: "@fosjsroutingbundle/resources/config/routing/routing.xml" 

and `` looks like:

security:     ...     firewalls:         ...         global:             pattern: /             anonymous: true             provider: fos_userbundle             form_login:                 csrf_provider: security.csrf.token_manager                 login_path: fos_user_security_login                 check_path: fos_user_security_check                 use_forward: true # if true, forward user login form instead of redirecting                 always_use_default_target_path: true # login success redirecting options (read further below)                 default_target_path: /admin                 target_path_parameter: _target_path                 use_referer: true                 remember_me: true             logout: ~             remember_me:                 secret:   '%secret%'                 lifetime: 604800 # 1 week in seconds                 path:     /      access_control:         - { path: ^/chat/, role: role_chatter }         - { path: ^/admin/, role: role_admin } 

after clear cache here tries , results:

  • login rol_chatter: going http://domain.tld/app_dev.php/chat/ expected login form , using valid credentials following message: access denied. chatter. right because have listener on security.interactive_login , doing when user login creds.
  • login rol_admin: going http://domain.tld/app_dev.php/admin/ expected login form , using valid credentials following message: bad credentials. wrong because credentials valid , @ least should message (access denied. admin) because listener on security.interactive_login said not happening.

info related listener on this post. what's wrong?

your issue regex used match requests global firewall /admin/(.*)|^/chat/(.*), check path /login_check. can see path not matched firewall leads error message posted.

if you, drop firewall fore login related stuff , change regex global firewall /. have add anonymous: true users not logged in able access login form. access protected areas still denied access control section.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -