コード例 #1
0
ファイル: Authorization.php プロジェクト: markwu/simpleid
 /**
  * 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);
 }
コード例 #2
0
ファイル: User.php プロジェクト: markwu/simpleid
 /**
  * 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);
 }
コード例 #3
0
ファイル: AuthManager.php プロジェクト: J0s3f/simpleid
 /**
  * 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;
 }