symfony - Redirect anonymous users from restricted areas in Symfony2 -


i've built web app using symfony 2.8 , i've got task of separating admin area front end. have done using following code in security.yml file:

security:     encoders:         myapp\bundle\corebundle\entity\users:             algorithm: sha512      role_hierarchy:         role_admin:        role_blocked      providers:         main:             entity: { class: myapp\bundle\corebundle\entity\users, property: username }      firewalls:         default:             anonymous: ~         secured_area:             pattern:    ^/admin             anonymous: ~             access_denied_url: core_login             form_login:                 check_path: core_login_check                 login_path: core_login                 failure_path: core_login                 default_target_path: ^/admin/booking/today/             logout:                 path:   core_logout                 target: core_login      access_control:         - { path: ^/admin, roles: 'role_admin' }         - { path: ^/ajax/admin, roles: 'role_admin' }         - { path: ^/ajax/backend, roles: 'role_admin' }         - { path: ^/, roles: 'is_authenticated_anonymously' } 

this working me in terms of blocking access areas want. however, if anonymous user tries access /admin following message:

full authentication required access resource.

when in production environment, standard 500 error.

what want have happen user redirected login page. isn't happening @ moment, can acheive this?


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -