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 | 96 | public function sign($data) |
|
27 | |||
28 | 27 | 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 | 24 | public function uploadToken( |
|
104 | |||
105 | /** |
||
106 | *上传策略,参数规格详见 |
||
107 | *http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html |
||
108 | */ |
||
109 | private static $policyFields = array( |
||
110 | 'callbackUrl', |
||
111 | 'callbackBody', |
||
112 | 'callbackHost', |
||
113 | 'callbackBodyType', |
||
114 | 'callbackFetchKey', |
||
115 | |||
116 | 'returnUrl', |
||
117 | 'returnBody', |
||
118 | |||
119 | 'endUser', |
||
120 | 'saveKey', |
||
121 | 'insertOnly', |
||
122 | |||
123 | 'detectMime', |
||
124 | 'mimeLimit', |
||
125 | 'fsizeMin', |
||
126 | 'fsizeLimit', |
||
127 | |||
128 | 'persistentOps', |
||
129 | 'persistentNotifyUrl', |
||
130 | 'persistentPipeline', |
||
131 | |||
132 | 'deleteAfterDays', |
||
133 | 'fileType', |
||
134 | |||
135 | 'upHosts', |
||
136 | ); |
||
137 | |||
138 | 24 | private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) |
|
150 | |||
151 | 51 | public function authorization($url, $body = null, $contentType = null) |
|
156 | } |
||
157 |