/**
  * remove certificate upload field, if a certificate already exists
  * @param $dc
  */
 public function onCertificateUpload($dc)
 {
     $authServer = \AuthClientServerModel::findByID(\Input::get('id'));
     if ($authServer->server_key != '') {
         unset($GLOBALS['TL_DCA']['tl_authclient_server']['fields']['server_key']);
     }
 }
Example #2
0
 /**
  * check for incoming request from the clc server
  * @return bool|void
  */
 public function listenForAuthResponse()
 {
     // run only in be mode
     if (TL_SCRIPT != 'contao/index.php' || TL_MODE != 'BE') {
         return;
     }
     // Initialize BackendUser before Database
     \BackendUser::getInstance();
     \Database::getInstance();
     $this->serverId = $serverId = intval(\Input::get('authid'));
     if ($serverId > 0) {
         $server = \AuthClientServerModel::findById($serverId);
         if (!$server) {
             return false;
         }
         $class = $server->auth_provider;
         $authProvider = new $class();
         $authProvider->setAuthServerId($serverId);
         $authProvider->setServerAddress($server->server_address);
         $authProvider->setPublicId($server->public_id);
         $authProvider->setPrivateKey($server->private_key);
         $authProvider->setServerKey($server->server_key);
         // Fix: temporarily disable request token
         $tokenStatus = $GLOBALS['TL_CONFIG']['disableRefererCheck'];
         $GLOBALS['TL_CONFIG']['disableRefererCheck'] = false;
         // TODO: check for exception / display error
         $response = $authProvider->checkResponse();
         // reset request token status
         $GLOBALS['TL_CONFIG']['disableRefererCheck'] = $tokenStatus;
         if ($response) {
             $this->loginUser($response);
         }
         return true;
     }
     return false;
 }