1 | <?php |
||
7 | final class Auth |
||
8 | { |
||
9 | private $accessKey; |
||
10 | private $secretKey; |
||
11 | |||
12 | public function __construct($accessKey, $secretKey) |
||
13 | { |
||
14 | $this->accessKey = $accessKey; |
||
15 | $this->secretKey = $secretKey; |
||
16 | } |
||
17 | |||
18 | 6 | public function getAccessKey() |
|
22 | |||
23 | 90 | public function sign($data) |
|
28 | |||
29 | 24 | public function signWithData($data) |
|
34 | |||
35 | 51 | public function signRequest($urlString, $body, $contentType = null) |
|
52 | |||
53 | public function verifyCallback($contentType, $originAuthorization, $url, $body) |
||
58 | |||
59 | 12 | public function privateDownloadUrl($baseUrl, $expires = 3600) |
|
74 | |||
75 | 24 | 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 | 'saveKey', |
||
122 | 'insertOnly', |
||
123 | |||
124 | 'detectMime', |
||
125 | 'mimeLimit', |
||
126 | 'fsizeMin', |
||
127 | 'fsizeLimit', |
||
128 | |||
129 | 'persistentOps', |
||
130 | 'persistentNotifyUrl', |
||
131 | 'persistentPipeline', |
||
132 | |||
133 | 'deleteAfterDays', |
||
134 | |||
135 | 'upHosts', |
||
136 | ); |
||
137 | |||
138 | private static $deprecatedPolicyFields = array( |
||
139 | 'asyncOps', |
||
140 | ); |
||
141 | |||
142 | 24 | private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) |
|
157 | |||
158 | 48 | public function authorization($url, $body = null, $contentType = null) |
|
163 | } |
||
164 |