很多SDK里都有这个签名URL访问
https://help.aliyun.com/document_detail/32016.html?spm=5176.doc32014.6.656.mnOlhD
使用签名URL发送请求
现在java SDK支持put object和get object两种方式的URL签名请求。
使用URL签名的方式getobject
//服务器端生成url签名字串
OSSClient Server = new OSSClient(endpoint, accessId, accessKey);
Date expiration = DateUtil.parseRfc822Date("Wed, 18 Mar 2015 14:20:00 GMT");
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, key, HttpMethod.GET);
//设置过期时间
request.setExpiration(expiration);
// 生成URL签名(HTTP GET请求)
URL signedUrl = Server .generatePresignedUrl(request);
System.out.println("signed url for getObject: " + signedUrl);
//客户端使用使用url签名字串发送请求
OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
Map<String, String> customHeaders = new HashMap<String, String>();
// 添加GetObject请求头
customHeaders.put("Range", "bytes=100-1000");
OSSObject object = client.getObject(signedUrl,customHeaders);