1 | <?php |
||
7 | final class Auth |
||
8 | { |
||
9 | private $accessKey; |
||
10 | private $secretKey; |
||
11 | |||
12 | public function __construct($accessKey, $secretKey) |
||
17 | 90 | ||
18 | public function getAccessKey() |
||
22 | |||
23 | 24 | public function sign($data) |
|
28 | |||
29 | 51 | public function signWithData($data) |
|
34 | 48 | ||
35 | 48 | public function signRequest($urlString, $body, $contentType = null) |
|
52 | |||
53 | 12 | public function verifyCallback($contentType, $originAuthorization, $url, $body) |
|
58 | 12 | ||
59 | 9 | public function privateDownloadUrl($baseUrl, $expires = 3600) |
|
74 | |||
75 | public function uploadToken( |
||
105 | |||
106 | /** |
||
107 | *上传策略,参数规格详见 |
||
108 | *http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html |
||
109 | */ |
||
110 | private static $policyFields = array( |
||
111 | 'callbackUrl', |
||
112 | 'callbackBody', |
||
113 | 'callbackHost', |
||
114 | 'callbackBodyType', |
||
115 | 'callbackFetchKey', |
||
116 | |||
117 | 'returnUrl', |
||
118 | 'returnBody', |
||
119 | |||
120 | 'endUser', |
||
121 | 24 | 'saveKey', |
|
122 | 'insertOnly', |
||
123 | 24 | ||
124 | 18 | 'detectMime', |
|
125 | 'mimeLimit', |
||
126 | 6 | 'fsizeMin', |
|
127 | 6 | 'fsizeLimit', |
|
128 | 3 | ||
129 | 'persistentOps', |
||
130 | 3 | 'persistentNotifyUrl', |
|
131 | 3 | 'persistentPipeline', |
|
132 | 3 | ||
133 | 3 | 'deleteAfterDays', |
|
134 | 3 | ||
135 | 'upHosts', |
||
136 | ); |
||
137 | 48 | ||
138 | private static $deprecatedPolicyFields = array( |
||
139 | 48 | 'asyncOps', |
|
140 | 48 | ); |
|
141 | |||
142 | private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) |
||
157 | |||
158 | public function authorization($url, $body = null, $contentType = null) |
||
163 | } |
||
164 |