Commit b34f96ed authored by yinjiacheng's avatar yinjiacheng

update 获取金山云token不单独做RSA加密处理

parent 60589079
package com.yidian.shenghuoquan.newscontent.http.httpbean
class GetKSYunTokenBean(val request: Request, val response: Response) {
data class Request(val tok: String?)
data class Request(
val http_method: String,
val date: String,
val resource: String,
val content_md5: String,
val content_type: String,
val headers: String
)
data class Response(val token: String)
}
......
......@@ -12,10 +12,10 @@ import com.ksyun.ks3.services.handler.PutObjectACLResponseHandler
import com.ksyun.ks3.services.handler.PutObjectResponseHandler
import com.ksyun.ks3.services.request.PutObjectRequest
import com.yidian.common.YdBaseApplication
import com.yidian.framework.mobile.xdiamond.SecretUtil
import com.yidian.shenghuoquan.newscontent.bean.KSYunTokenBean
import com.yidian.shenghuoquan.newscontent.http.ApiService
import com.yidian.shenghuoquan.newscontent.http.httpbean.*
import com.yidian.shenghuoquan.newscontent.http.httpbean.GetKSYunObjectIdBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.GetKSYunTokenBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.IGetKSYunObjectIdCallback
import com.yidian.utils.MD5Util
import com.yidian.yac.ftdevicefinger.core.FtDeviceFingerManager
import cz.msebera.android.httpclient.Header
......@@ -266,20 +266,16 @@ class KS3Core private constructor(val context: Context) : AuthListener {
TAG,
"KSYun calculate auth, httpMethod: $httpMethod, contentType: $contentType, date: $date, contentMD5: $contentMD5, resource: $resource, headers: $headers"
)
val tok = SecretUtil.rsaEncrypt(
gson.toJson(
KSYunTokenBean(
SecretUtil.sign(httpMethod + date + resource),
httpMethod,
date,
resource,
contentType,
contentMD5,
headers
)
return ApiService.getKSYunToken(
GetKSYunTokenBean.Request(
httpMethod,
date,
resource,
contentMD5,
contentType,
headers
)
)
return ApiService.getKSYunToken(GetKSYunTokenBean.Request(tok))?.result?.token
)?.result?.token
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment