4

I am trying to set my app's security layer without any success. What I am trying to do is setting a security firewall via a form authentication listener but customized for authenticating the user against an API REST.

I found an amazing tutorial for Symfony2 that cover my needs but I can't translate it at all to the Silex way.

I think my firewall configuration should look similar like this:

$app->register(
    new Silex\Provider\SecurityServiceProvider(),
    array(
        'security.firewalls' => array(
            'default' => array(
                'pattern'   => '^/',
                'anonymous' => true,
                'api'       => array(
                    'login_path' => '/login',
                    'check_path' => '/login_check',
                ),
                'logout'    => array('logout_path' => '/logout')
            ),
        ),
    )
);

...because the security requirements right now are:

  • Any user can freely move around on the site
  • A logged user (via form) can do more actions and see other features

Another good tutorial on something similar is the official one: http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-authentication-provider

But I can't get them mixed up to work properly.

4

0 回答 0