@@ -23,50 +23,50 @@ class Signature
2323 /**
2424 * 获取 Header 签名需要的请求头
2525 *
26- * @param Config $bucketConfig
26+ * @param Config $serviceConfig
2727 * @param $method 请求方法
2828 * @param $path 请求路径
2929 * @param $contentMd5 文件内容 md5
3030 *
3131 * @return array
3232 */
33- public static function getHeaderSign ($ bucketConfig , $ method , $ path , $ contentMd5 = null )
33+ public static function getHeaderSign ($ serviceConfig , $ method , $ path , $ contentMd5 = null )
3434 {
3535 $ gmtDate = gmdate ('D, d M Y H:i:s \G\M\T ' );
3636
3737 $ policy = null ;
38- $ sign = self ::getBodySignature ($ bucketConfig , $ method , $ path , $ gmtDate , $ policy , $ contentMd5 );
38+ $ sign = self ::getBodySignature ($ serviceConfig , $ method , $ path , $ gmtDate , $ policy , $ contentMd5 );
3939
4040 $ headers = array (
4141 'Authorization ' => $ sign ,
4242 'Date ' => $ gmtDate ,
43- 'User-agent ' => 'Php-Sdk/ ' . $ bucketConfig ->getVersion ()
43+ 'User-agent ' => 'Php-Sdk/ ' . $ serviceConfig ->getVersion ()
4444 );
4545 return $ headers ;
4646 }
4747
4848 /**
4949 * 获取请求缓存刷新接口需要的签名头
5050 *
51- * @param Config $bucketConfig
51+ * @param Config $serviceConfig
5252 * @param $urlString
5353 *
5454 * @return array
5555 */
56- public static function getPurgeSignHeader (Config $ bucketConfig , $ urlString )
56+ public static function getPurgeSignHeader (Config $ serviceConfig , $ urlString )
5757 {
5858 $ gmtDate = gmdate ('D, d M Y H:i:s \G\M\T ' );
59- $ sign = md5 ("$ urlString& {$ bucketConfig -> bucketName }& $ gmtDate& {$ bucketConfig ->operatorPassword }" );
59+ $ sign = md5 ("$ urlString& {$ serviceConfig -> serviceName }& $ gmtDate& {$ serviceConfig ->operatorPassword }" );
6060 return array (
61- 'Authorization ' => "UpYun {$ bucketConfig -> bucketName }: {$ bucketConfig ->operatorName }: $ sign " ,
61+ 'Authorization ' => "UpYun {$ serviceConfig -> serviceName }: {$ serviceConfig ->operatorName }: $ sign " ,
6262 'Date ' => $ gmtDate ,
63- 'User-agent ' => 'Php-Sdk/ ' . $ bucketConfig ->getVersion () . ' (purge api) '
63+ 'User-agent ' => 'Php-Sdk/ ' . $ serviceConfig ->getVersion () . ' (purge api) '
6464 );
6565 }
6666
6767 /**
6868 * 获取表单 API 需要的签名,依据 body 签名规则计算
69- * @param Config $bucketConfig
69+ * @param Config $serviceConfig
7070 * @param $method 请求方法
7171 * @param $uri 请求路径
7272 * @param $date 请求时间
@@ -75,7 +75,7 @@ public static function getPurgeSignHeader(Config $bucketConfig, $urlString)
7575 *
7676 * @return array
7777 */
78- public static function getBodySignature (Config $ bucketConfig , $ method , $ uri , $ date = null , $ policy = null , $ contentMd5 = null )
78+ public static function getBodySignature (Config $ serviceConfig , $ method , $ uri , $ date = null , $ policy = null , $ contentMd5 = null )
7979 {
8080 $ data = array (
8181 $ method ,
@@ -92,7 +92,7 @@ public static function getBodySignature(Config $bucketConfig, $method, $uri, $da
9292 if ($ contentMd5 ) {
9393 $ data [] = $ contentMd5 ;
9494 }
95- $ signature = base64_encode (hash_hmac ('sha1 ' , implode ('& ' , $ data ), $ bucketConfig ->operatorPassword , true ));
96- return 'UPYUN ' . $ bucketConfig ->operatorName . ': ' . $ signature ;
95+ $ signature = base64_encode (hash_hmac ('sha1 ' , implode ('& ' , $ data ), $ serviceConfig ->operatorPassword , true ));
96+ return 'UPYUN ' . $ serviceConfig ->operatorName . ': ' . $ signature ;
9797 }
9898}
0 commit comments