[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/auth/storage/ -> PhabricatorAuthFactorConfig.php (source)

   1  <?php
   2  
   3  final class PhabricatorAuthFactorConfig extends PhabricatorAuthDAO {
   4  
   5    protected $userPHID;
   6    protected $factorKey;
   7    protected $factorName;
   8    protected $factorSecret;
   9    protected $properties = array();
  10  
  11    public function getConfiguration() {
  12      return array(
  13        self::CONFIG_SERIALIZATION => array(
  14          'properties' => self::SERIALIZATION_JSON,
  15        ),
  16        self::CONFIG_AUX_PHID => true,
  17        self::CONFIG_COLUMN_SCHEMA => array(
  18          'factorKey' => 'text64',
  19          'factorName' => 'text',
  20          'factorSecret' => 'text',
  21        ),
  22        self::CONFIG_KEY_SCHEMA => array(
  23          'key_user' => array(
  24            'columns' => array('userPHID'),
  25          ),
  26        ),
  27      ) + parent::getConfiguration();
  28    }
  29  
  30    public function generatePHID() {
  31      return PhabricatorPHID::generateNewPHID(
  32        PhabricatorAuthAuthFactorPHIDType::TYPECONST);
  33    }
  34  
  35    public function getImplementation() {
  36      return idx(PhabricatorAuthFactor::getAllFactors(), $this->getFactorKey());
  37    }
  38  
  39    public function requireImplementation() {
  40      $impl = $this->getImplementation();
  41      if (!$impl) {
  42        throw new Exception(
  43          pht(
  44            'Attempting to operate on multi-factor auth which has no '.
  45            'corresponding implementation (factor key is "%s").',
  46            $this->getFactorKey()));
  47      }
  48  
  49      return $impl;
  50    }
  51  
  52  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1