Example #1
0
 /**
  * Get public key
  *
  * Gets the public key for the issuer. If our own identity provider is the issuer, we
  * can load our own public key avoiding network traffic.
  *
  * @access public
  * @static
  * @param string $issuer The issuers domain
  * @return AbstractPublicKey
  */
 public static function getPublicKey($issuer)
 {
     // allow other retrievers for testing
     if ($issuer === Configuration::getInstance()->get("hostname")) {
         return Secrets::loadPublicKey();
     }
     /*else if (config.get('disable_primary_support')) {
         throw new \Exception("this verifier doesn't respect certs issued from domains other than: " . Configuration::getInstance()->get("hostname"));
       }*/
     // let's go fetch the public key for this host
     return Primary::getPublicKey($issuer);
 }
Example #2
0
 /**
  * Initialization routine
  *
  * @access public
  * @static
  */
 public static function initialize()
 {
     if (Primary::$initialized) {
         return;
     }
     // Support "shimmed primaries" for local development. That is an environment variable that is any number of
     // CSV values of the form:
     // <domain>|<origin>|<path to .well-known/browserid>,
     // where 'domain' is the domain that we would like to shim. 'origin' is the origin to which traffic should
     // be directed, and 'path to .well-known/browserid' is a path to the browserid file for the domain
     //  foreach(Configuration::getInstance()->get("shimmed_primaries") as $primary)
     //{
     Primary::$well_know_path = Utils::path_concat(Configuration::getInstance()->get('base_path'), Configuration::getInstance()->get("shimmed_path"));
     if (is_file(Utils::path_concat(Primary::$well_know_path, 'persona.org'))) {
         //load sample file
         Primary::updateShimCache('login.persona.org', file_get_contents(Utils::path_concat(Primary::$well_know_path, 'persona.org')));
     }
     /*$dom=array(
         'login.persona.org'=> array(
         'origin'=>'https://login.persona.org',
         //'delegate'=>'persona.org',
         'PublicKeyFile'=>'1')
       );*/
     //file_put_contents(Primary::$indexFile,json_encode($dom));
     //list($domain, $origin, $path) = explode("|", $primary);
     //logger.info("inserted primary info for '" + domain + "' into cache, TODO point at '" + origin + "'");
     //}
     Primary::$public_key = Secrets::loadPublicKey();
     Primary::$initialized = true;
 }