Esempio n. 1
0
 /**
  * Builds a hash of the owner and client for identification
  * purposes
  *
  * @param Storable $owner the Storable object representing the resource
  * owner
  * @param Storable $client the Storable object representing the
  * client
  * @return string the hash
  */
 public static function buildID($owner, $client)
 {
     $owner_id = $owner->getStoreType() . ':' . $owner->getStoreID();
     $client_id = $client->getStoreType() . ':' . $client->getStoreID();
     $opaque = new OpaqueIdentifier();
     return $opaque->generate($owner_id . ':' . $client_id);
 }
Esempio n. 2
0
 /**
  * Generates a pairwise identity for this user, based on a specified
  * sector identifier.
  *
  * A *pairwise identity* is an opaque string that is unique to one or more clients
  * (identified by a common `$sector_identifier` parameter) which identifies the
  * user to those clients.  Issuing a pairwise identity means that the user's
  * SimpleID user name is not exposed to the clients.
  *
  * @param string $sector_identifier the client's sector identifier.
  * @return string the pairwise identity
  */
 public function getPairwiseIdentity($sector_identifier)
 {
     $opaque = new OpaqueIdentifier();
     return 'pwid:' . $opaque->generate($sector_identifier . ':' . $this->uid);
 }
Esempio n. 3
0
 /**
  * Returns a relatively unique cookie name based on a specified suffix.
  *
  * @param string $suffix the cookie name suffix
  * @return string the cookie name
  */
 public function getCookieName($suffix)
 {
     if (self::$cookie_prefix == NULL) {
         $opaque = new OpaqueIdentifier();
         self::$cookie_prefix = substr($opaque->generate('cookie'), -9) . '_';
     }
     return self::$cookie_prefix . $suffix;
 }