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