Ejemplo n.º 1
0
 /**
  * @param Application $app
  */
 public function register(Application $app)
 {
     $app['security_path'] = preg_replace(array('/^\\//', '/\\/$/'), '', $app['security_path']);
     $app['security.firewalls'] = array('login' => array('pattern' => sprintf('^/%s/login$', $app['security_path'])), 'secured' => array('pattern' => sprintf('^/%s', $app['security_path']), 'form' => array('login_path' => sprintf('/%s/login', $app['security_path']), 'check_path' => sprintf('/%s/login_check', $app['security_path'])), 'logout' => array('logout_path' => sprintf('/%s/logout', $app['security_path'])), 'users' => $app->share(function () use($app) {
         return new UserServiceProvider($app);
     })));
     // inicialize
     parent::register($app);
 }
Ejemplo n.º 2
0
 /**
  * Register with \Silex\Application.
  * @param \Silex\Application $app
  */
 public function register(\Silex\Application $app)
 {
     parent::register($app);
     // Register voters
     $app->extend('security.voters', function ($voters) {
         return array_merge($voters, $this->voters);
     });
     // Register firewalls
     $this->app = $app;
     foreach ($this->firewalls as $firewall) {
         $firewall->register($this);
     }
     // Add reference to this in application instance
     $this->app['securilex'] = $this;
 }
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param   Application $app
  *
  * @return  void
  */
 public function register(Application $app)
 {
     parent::register($app);
     $app['cors_preflight_request_matcher'] = new PreflightRequestMatcher($app);
 }