symfony - custom authentication provider with anonymous user -


i have question didn't find answer for.

i have maintain symfony application uses custom authentication , user provider. provider works aspected , user can login correctly.

however, need make few routes accessible anonymous users. should accessible when user not authenticated. tried adjust access_control configuration in security.yml make these urls accessible:

firewalls:     dev:         pattern:  ^/(_(profiler|wdt)|css|images|js)/         security: false      main:         pattern: ~         anonymous: ~         internal_api:             provider:        fos_userbundle             check_path:      /api/user/login          logout:             path:   /api/user/logout  access_control:     - { path: ^/api/init, roles: is_authenticated_anonymously }     - { path: ^/api/resources, roles: is_authenticated_anonymously }     - { path: ^/, roles: role_user } 

unfortunately not work. users still can't access these routes, long not authenticated.

so question is: necessary provide role is_authenticated_anonymously via custom authentication provider? can done or have adjust security.yml settings?

best regards

because routes want make accessible anonymous behind main firewall , protected path: ^/ access_control, have create specific firewall them.

add in firewalls of security.yml :

api_resources:     pattern: ^/api/resources     anonymous: ~  api_init:      pattern: ^/api/init     anonymous: ~ 

and should works.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -