php - Symfony2 Firewall: Redirect to registration form instead of login -



php - Symfony2 Firewall: Redirect to registration form instead of login -

i working on simple shop (to compile offers) based on symfony2.

after adding items cart, user can proceed summary of offer , request compiled offer.

the summary page protected next firewall:

security: firewalls: secured_area: pattern: ^/ anonymous: ~ provider: default form_login: login_path: acme_security_login_route check_path: acme_security_login_check_route csrf_provider: form.csrf_provider logout: ~ default: anonymous: ~ access_control: - { path: ^/request-offer, roles: role_client } providers: default: entity: { class: acmeshopbundle:user } encoders: symfony\component\security\core\user\user: plaintext acme\shopbundle\entity\user: algorithm: bcrypt cost: 15

this means if client logged in, straight summary, , if not, redirected login page.

now more probable client new client redirect registration form, instead.

the options described in securitybundle configuration reference don't allow this. of course of study changing login_path not solution.

what nicest possible solution that?

in sentiment nice solution add together own accessdeniedexceptionhandler, how explained here.

using symfony2's accessdeniedhandlerinterface

further more, made service configurable via configuration component, pass argument route redirect.

http://symfony.com/doc/current/components/config/definition.html

if can change, if got more users, redirect login page without editing class.

php security symfony2 authentication

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -