ソースを参照

debug authtoken call

andre 5 年 前
コミット
8812139d04
2 ファイル変更2 行追加49 行削除
  1. 0 47
      api/Zm/Auth.php
  2. 2 2
      zimbraSingle.php

+ 0 - 47
api/Zm/Auth.php

@@ -278,53 +278,6 @@ class Zm_Auth
 		}
 		return $result;
 	}
-
-	/**
-	 * preauth
-	 *
-	 * Use this method to login to a Zimbra server after you create an instance of this class
-	 *
-	 * Login parameters must be specified when calling the constructor
-	 */
-	function preauth($key)
-	{
-		$result = null;
-
-		$n = 0;
-		while (true)
-		{
-			try
-			{
-				$this->setSoapHeader();
-
-				$result = $this->client->__soapCall("AuthRequest", $this->params, null, $this->getSoapHeader());
-				// $result = $this->client->__getLastResponse();
-				// print_var($result);
-				// Save the soapHeader with token
-				$this->setSoapHeader($result['authToken']);
-				break;
-			}
-			catch (SoapFault $exception)
-			{
-				// if $retryAttempts>0 retry after a random time using exponential backoff
-				// for user logins retries just once
-				$n++;
-				if ($this->retryAttempts > 0 &&
-					$n <= $this->retryAttempts && ($this->context == "admin" || $n == 1) ) {
-					$minT = 1+$n*1000000/10;
-					$maxT = pow(2, $n-1)*1000000;
-					$waitT = rand($minT, $maxT);
-					// wait times are shorter on login
-					$waitT = $waitT/5;
-					usleep($waitT);
-				} else {
-					$result = $exception;
-					break;
-				}
-			}
-		}
-		return $result;
-	}
 }
 
 ?>

+ 2 - 2
zimbraSingle.php

@@ -771,8 +771,8 @@ function zimbraSingle_ServiceSingleSignOn($params) {
     }
     $webmailUrl = zimbraSingleFindAll($accountInfo, 'PUBLICMAILURL');
     $timestamp=time()*1000;
-    $preauthToken=hash_hmac("sha1",$username."|name|0|".$timestamp,$preAuthKey);
-    $preauthURL = $webmailUrl[0]['DATA']."?account=".$username."&by=name&timestamp=".$timestamp."&expires=0&preauth=".$preauthToken;
+    $preauthToken=hash_hmac("sha1",$params['username']."|name|0|".$timestamp,$preAuthKey);
+    $preauthURL = $webmailUrl[0]['DATA']."?account=".$params['username']."&by=name&timestamp=".$timestamp."&expires=0&preauth=".$preauthToken;
     return array(
         'success' => true,
         'redirectTo' => $preauthURL,