public function register(Application $app)
 {
     $app['soauth.test'] = false;
     $app['security.authentication_listener.factory.soauth'] = $app->protect(function ($name, $options) use($app) {
         $app['security.authentication_provider.' . $name . '.soauth'] = $app->share(function () use($app, $name) {
             return null;
         });
         $app['security.authentication_listener.' . $name . '.soauth'] = $app->share(function () use($app, $name) {
             $listener = new Listener($name, $app['security'], $app['soauth.access.provider']);
             if (isset($app['logger']) && $app['logger']) {
                 $listener->setLogger($app['logger']);
             }
             return $listener;
         });
         return array('security.authentication_provider.' . $name . '.soauth', 'security.authentication_listener.' . $name . '.soauth', null, 'pre_auth');
     });
     $app['soauth.access.provider'] = $app->share(function (Application $app) {
         $accessProvider = new AccessProvider($app['soauth.test'] ? $app['soauth.storage.handler.mock'] : $app['soauth.storage.handler'], $app['soauth.client.provider'], $app['soauth.user.provider']);
         if (isset($app['logger']) && $app['logger']) {
             $accessProvider->setLogger($app['logger']);
         }
         return $accessProvider;
     });
     $app['soauth.storage.handler.mock'] = $app->share(function (Application $app) {
         return new MockStorageHandler();
     });
     $app['soauth.client.provider'] = $app->share(function (Application $app) {
         return new ClientProvider($app['soauth.client.provider.config']);
     });
     $app['soauth.user.provider'] = $app->share(function (Application $app) {
         return new UserProvider($app['soauth.user.provider.config']);
     });
     $app['soauth.user.provider.config'] = [];
     $app['soauth.client.provider.config'] = [];
 }