0

I receive the following exception if I use the "simple_form"-option in my security.yml:

ServiceNotFoundException: The service "security.firewall.map.context.secured_area"
has a dependency on a non-existent service
"security.authentication.success_handler.secured_area.simple_form".

And I need the "simple_form" sinds it has the "authenticator"-option. Using "form_login" results in the following exception:

InvalidConfigurationException: Unrecognized options "authenticator" under "security.firewalls.secured_area.form_login"

My security.yml (only relevant config copied)

security:
  firewalls:
    secured_area:
      simple_form:
        login_path: /login
        check_path: /login_check
        authenticator: some_wild_authenticator
        use_referer: true
        csrf_provider: form.csrf_provider
        success_handler: security.authentication.success_handler
        failure_handler: security.authentication.failure_handler

Did I miss something? Bug? Not possible? Solution? Workaround?

I run SF2.4

Source

7
  • pattern: ^/your_pattern is missing
    – Nisam
    Mar 19, 2014 at 12:02
  • No I have it, not copied it since it's inrelevant.
    – Katch
    Mar 19, 2014 at 12:20
  • Please look at my security config, pastebin.com/ZJgC0LZw its worked for me
    – Nisam
    Mar 19, 2014 at 12:25
  • You don't have my option "authenticator".
    – Katch
    Mar 19, 2014 at 12:28
  • @Airoude did you figure this out? I am running into the exact same problem.
    – msumme
    Nov 17, 2014 at 20:59

4 Answers 4

1

there's a bug in Symfony and you have to register success_handler as service id security.authentication.success_handler.secured_area.simple_form, using other names for of service will result with the exception

ServiceNotFoundException: The service "security.firewall.map.context.secured_area" has a dependency on a non-existent service "security.authentication.success_handler.secured_area.simple_form".

this error still occurs in Symfony 2.5.8

0

Try adding the following to your services.yml:

parameters:
    custom.success.handler.class: Acme\DemoBundle\Security\CustomLoginSuccessHandler

services:
    security.authentication.success_handler.secured_area.simple_form:
        class: %custom.success.handler.class%
        tags:
          - { name: 'monolog.logger', channel: 'security' }

Replace the "custom success handler" stuff with the information relevant to your project.

0

I discovered (and this is not a "best practice") a workaround.

I redefined my success_handler service as "security.authentication.success_handler.secured_area.simple_form" (or in my case - a different string than "secured_area").

By giving it that name, and not using the "success_handler" option under simple_form, I was able to get my success handler to be used.

I'm hoping they fix this soon, as that kind of workaround makes me a little uneasy during updates.

-1

Use FOS User bundle FOS User Bundle for this. Please see the documentation and configure this security firewall properly.

3
  • This bundle would be one of the last I'd recommend.
    – Anyone
    Apr 9, 2014 at 6:35
  • @Anyone And why is that? May 6, 2014 at 14:14
  • 2
    (1) Because FOS Bundles contain 90% of code that is not needed, should be separated. (2) That bundles is only good as long as you use it exactly the way it's designed without custom changes.
    – Anyone
    May 6, 2014 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.