I am trying to set the security level of an application without any success. What I'm trying to do is install a security firewall through a form authentication listener, but configured to authenticate the user against the REST API.
I found an awesome tutorial for Symfony2 that covers my needs, but I can't fully translate it to the Silex way.
I think my firewall configuration should look something 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 security requirements now:
- Any user can freely navigate the site.
- A registered user (through the form) can perform more actions and see other functions.
Another good tutorial on something like this is official: http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-authentication-provider
But I canβt make them mix to work properly.
source share