Beispiel #1
0
 function validateToken($token, $signkey = null)
 {
     if (!$signkey) {
         $signkey = $this->_signkey;
     }
     if (!$token) {
         WindowsLiveLogin::debug("Error: validateToken: Invalid token.");
         return;
     }
     $split = explode("&sig=", $token);
     if (count($split) != 2) {
         WindowsLiveLogin::debug("ERROR: validateToken: Invalid token: {$token}");
         return;
     }
     list($body, $sig) = $split;
     $sig = WindowsLiveLogin::u64($sig);
     if (!$sig) {
         WindowsLiveLogin::debug("Error: validateToken: Could not extract signature from token.");
         return;
     }
     $sig2 = WindowsLiveLogin::signToken($body, $signkey);
     if (!$sig2) {
         WindowsLiveLogin::debug("Error: validateToken: Could not generate signature for the token.");
         return;
     }
     if ($sig == $sig2) {
         return $token;
     }
     WindowsLiveLogin::debug("Error: validateToken: Signature did not match.");
     return;
 }