/**
  * Before middleware to:
  * - Add our logging handler during debug mode
  * - Set the request's provider in the provider manager
  *
  * @param Request     $request
  * @param Application $app
  */
 public function before(Request $request, Application $app)
 {
     if ($this->config->isDebug()) {
         $debuglog = $app['resources']->getPath('cache') . '/authenticate.log';
         $app['logger.system']->pushHandler(new StreamHandler($debuglog, Logger::DEBUG));
     }
     // Fetch the request off the stack so we don't get called out of cycle
     $request = $app['request_stack']->getCurrentRequest();
     $app['clientlogin.provider.manager']->setProvider($app, $request);
 }
 /**
  * Construct the authorisation URL with query parameters.
  *
  * @param string $providerName
  *
  * @return string
  */
 protected function getCallbackUrl($providerName)
 {
     $key = $this->config->get('response_noun');
     $url = $this->rootUrl . $this->config->getUriBase() . "/oauth2/callback?{$key}={$providerName}";
     $this->logger->debug("[ClientLogin][Provider]: Setting callback URL: {$url}");
     return $url;
 }
 /**
  * Get a button's class
  *
  * @param string $provider
  * @param array  $values
  *
  * @return string
  */
 private function getClass($provider, $values)
 {
     if (isset($values['type']) && $values['type'] == 'OpenID') {
         return $this->config->get('zocial') ? 'zocial openid' : 'openid';
     }
     return $this->config->get('zocial') ? "zocial {$provider}" : $provider;
 }
 public function testIsDebug()
 {
     $config = new Config(array(), 'http://example.com');
     $this->assertFalse($config->isDebug());
 }