silex-oauth icon indicating copy to clipboard operation
silex-oauth copied to clipboard

Unable to set different pattern for the protected area

Open russellseymour opened this issue 8 years ago • 1 comments

Hello,

I am implementing OAuth on an area of my application. I am moving from Form based auth to OAuth.

I have been trying to set the pattern for the login to something other that ^/ but I keep getting an error message when I click on my Google button:

image

The firewall is setup as follows:

    $app['security.firewalls'] = [
      'login' => [
        'pattern' => '^/admin',
        'anonymous' => true,
        'oauth' => [
          'failure_path' => '/login',
          'with_csrf' => true
        ],
        'users' => $app -> share(function() use ($app) {
          return $app['model.account'];
        })
      ]
    ];

If I leave the pattern as `^/' then it works, does this mean that it is only possible to use OAuth across the whole website?

Thanks, Russell

russellseymour avatar May 10 '16 14:05 russellseymour

@russellseymour: Be sure to include this in the additional path as they should be secured as well, for example:

'default' => array(
            'pattern' => '^/admin',
            'anonymous' => false,
            'oauth' => array(
                'login_path' => '/admin/auth/{service}',
                'callback_path' => '/admin/auth/{service}/callback',
                'check_path' => '/admin/auth/{service}/check',
                'failure_path' => '/login',
                'with_csrf' => true
            )...

rpensek avatar Oct 09 '17 12:10 rpensek