function get($assoc_type)
 {
     assert('$assoc_type == "HMAC-SHA1"');
     // $handle = sprintf( '{%s}%d/%d',  $assoc_type, localtime(), $this->count );
     $path = tempnam($this->store_dir, $assoc_type . '_');
     $handle = basename($path);
     $this->count += 1;
     $secret = oidUtil::random_string(20, null);
     $assoc = Association::from_expires_in($handle, $secret, $this->lifespan);
     $fh = fopen($path, 'w');
     if ($fh) {
         fwrite($fh, base64_encode(@serialize($assoc)));
         fclose($fh);
     }
     return $assoc;
 }
Exemple #2
0
 function SampleConsumer($http_client, $assoc_mngr)
 {
     parent::OpenIDConsumer($http_client, $assoc_mngr);
     $path = '/tmp/oid_secret.txt';
     $secret = null;
     if (file_exists($path)) {
         $secret = unserialize(file_get_contents($path));
     }
     if (!$secret) {
         $secret = oidUtil::random_string(20, null);
         @file_put_contents($path, serialize($secret));
     }
     $this->secret = $secret;
 }