コード例 #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);
 }
コード例 #2
0
ファイル: ServiceProvider.php プロジェクト: mlukman/securilex
 /**
  * Boot with Silex Application
  * @param \Silex\Application $app
  */
 public function boot(\Silex\Application $app)
 {
     $i = 0;
     $firewalls = array();
     foreach ($this->unsecuredPatterns as $pattern => $v) {
         $firewalls['unsecured_' . $i++] = array('pattern' => $pattern);
     }
     $finalConfig = array_merge($firewalls, $this->firewallConfig);
     $app['security.firewalls'] = $finalConfig;
     parent::boot($app);
 }
コード例 #3
0
 /**
  * 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);
 }