1 | <?php |
||
6 | final class Auth |
||
7 | { |
||
8 | private $accessKey; |
||
9 | private $secretKey; |
||
10 | |||
11 | public function __construct($accessKey, $secretKey) |
||
16 | |||
17 | 6 | public function getAccessKey() |
|
21 | |||
22 | 93 | public function sign($data) |
|
27 | |||
28 | 24 | public function signWithData($data) |
|
33 | |||
34 | 54 | public function signRequest($urlString, $body, $contentType = null) |
|
51 | |||
52 | public function verifyCallback($contentType, $originAuthorization, $url, $body) |
||
57 | |||
58 | 12 | public function privateDownloadUrl($baseUrl, $expires = 3600) |
|
73 | |||
74 | 21 | public function uploadToken( |
|
94 | |||
95 | /** |
||
96 | *上传策略,参数规格详见 |
||
97 | *http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html |
||
98 | */ |
||
99 | private static $policyFields = array( |
||
100 | 'callbackUrl', |
||
101 | 'callbackBody', |
||
102 | 'callbackHost', |
||
103 | 'callbackBodyType', |
||
104 | 'callbackFetchKey', |
||
105 | |||
106 | 'returnUrl', |
||
107 | 'returnBody', |
||
108 | |||
109 | 'endUser', |
||
110 | 'saveKey', |
||
111 | 'insertOnly', |
||
112 | |||
113 | 'detectMime', |
||
114 | 'mimeLimit', |
||
115 | 'fsizeMin', |
||
116 | 'fsizeLimit', |
||
117 | |||
118 | 'persistentOps', |
||
119 | 'persistentNotifyUrl', |
||
120 | 'persistentPipeline', |
||
121 | |||
122 | 'deleteAfterDays', |
||
123 | 'fileType', |
||
124 | 'isPrefixalScope', |
||
125 | ); |
||
126 | |||
127 | 21 | private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) |
|
139 | |||
140 | 51 | public function authorization($url, $body = null, $contentType = null) |
|
145 | } |
||
146 |