<button id="qvlbh"><button id="qvlbh"></button></button>
<xmp id="qvlbh"><xmp id="qvlbh"><xmp id="qvlbh"><address id="qvlbh"><output id="qvlbh"></output></address>
<xmp id="qvlbh"><legend id="qvlbh"></legend>
<xmp id="qvlbh"> <address id="qvlbh"><output id="qvlbh"></output></address>
<address id="qvlbh"><button id="qvlbh"></button></address>
<button id="qvlbh"><samp id="qvlbh"></samp></button>
<address id="qvlbh"><button id="qvlbh"></button></address><address id="qvlbh"></address>
<address id="qvlbh"><legend id="qvlbh"></legend></address>
<samp id="qvlbh"><xmp id="qvlbh"><legend id="qvlbh"></legend>
中國站
幫助中心 > 網(wǎng)絡(luò )與加速 > CDN云加速 > 訪(fǎng)問(wèn)控制 > 鑒權方式A說(shuō)明

鑒權方式A說(shuō)明

URL鑒權功能主要用于保護用戶(hù)站點(diǎn)資源不被非法站點(diǎn)下載盜用。億速云CDN為您提供了三種鑒權方式,本文為您詳細介紹鑒權方式A的原理和示例說(shuō)明。

原理說(shuō)明

訪(fǎng)問(wèn)加密URL構成:
http://DomainName/Filename?auth_key=timestamp-rand-uid-md5hash
鑒權字段描述如下表所示。

字段 描述
DomainName CDN站點(diǎn)的域名。
Filename 實(shí)際回源訪(fǎng)問(wèn)的URL,鑒權時(shí)Filename需以正斜線(xiàn)(/)開(kāi)頭。
auth_key 您設定的鑒權密鑰。
timestamp 失效時(shí)間,整型正數,固定長(cháng)度10,值為1970年1月1日以來(lái)的當前時(shí)間秒數+過(guò)期時(shí)間秒數。用來(lái)控制失效時(shí)間,過(guò)期時(shí)間由客戶(hù)端設置,若設置為1800s,您訪(fǎng)問(wèn)CDN的時(shí)間超過(guò)1800s后,該鑒權失效。例如,您設置訪(fǎng)問(wèn)時(shí)間為2020-08-15 15:00:00,則鏈接的真正失效時(shí)間為2020-08-15 15:30:00。
rand 隨機數。建議使用UUID,不能包含中劃線(xiàn)(-),例如:477b3bbc253f467b8def6711128c7bec。
uid 用戶(hù)ID,暫未使用(設置成0即可)。
md5hash 通過(guò)md5算法計算出的字符串,由數字0-9和小寫(xiě)英文字母a-z混合組成,固定長(cháng)度32。

CDN服務(wù)器接到資源訪(fǎng)問(wèn)請求后,判斷最終生成鑒權URL請求中的timestamp+鑒權key的有效時(shí)間是否小于當前時(shí)間。
如果timestamp+鑒權key的有效時(shí)間小于當前時(shí)間,服務(wù)器判定過(guò)期失效,并返回HTTP 403錯誤。
如果timestamp+鑒權key的有效時(shí)間大于當前時(shí)間,構造出一個(gè)同樣的字符串,參考下方sstring字符串,然后使用MD5算法算出HashValue的值,再與請求中md5hash的值進(jìn)行比對。
結果一致,鑒權通過(guò),返回資源請求。
結果不一致,鑒權失敗,返回HTTP 403錯誤。
HashValue的值是通過(guò)以下字符串計算得到的。
sstring = "URI-Timestamp-rand-uid-PrivateKey"(URI是用戶(hù)的請求對象相對地址,不包含參數,如/Filename) HashValue = md5sum(sstring)

示例說(shuō)明

通過(guò)以下示例說(shuō)明,您可以準確理解鑒權方式A的實(shí)現方式。
1.通過(guò)req_auth請求對象。
http:// cdn.example.com/video/standard/1K.html
2.設置密鑰為:aliyuncdnexp1234。
3.設置鑒權配置文件有效時(shí)間為:2015年10月10日00:00:00,計算出秒數為:1444435200。
4.CDN服務(wù)器會(huì )構造一個(gè)用于計算Hashvalue的簽名字符串。
/video/standard/1K.html-1444435200-0-0-aliyuncdnexp1234
5.根據該簽名字符串,CDN服務(wù)器會(huì )計算出Hashvalue。
HashValue = md5sum("/video/standard/1K.html-1444435200-0-0-aliyuncdnexp1234") =` 80cd3862d699b7118eed99103f2a3a4f` 加密URL請求。http://cdn.example.com/video/standard/1K.html?auth_key=1444435200-0-0`-80cd3862d699b7118eed99103f2a3a4f`

国产精品香港三级|日韩精品无码免费专区网站|熟女一区二区三区|一本伊大人香蕉久久网|jzzijzzij亚洲乱熟无码
<button id="qvlbh"><button id="qvlbh"></button></button>
<xmp id="qvlbh"><xmp id="qvlbh"><xmp id="qvlbh"><address id="qvlbh"><output id="qvlbh"></output></address>
<xmp id="qvlbh"><legend id="qvlbh"></legend>
<xmp id="qvlbh"> <address id="qvlbh"><output id="qvlbh"></output></address>
<address id="qvlbh"><button id="qvlbh"></button></address>
<button id="qvlbh"><samp id="qvlbh"></samp></button>
<address id="qvlbh"><button id="qvlbh"></button></address><address id="qvlbh"></address>
<address id="qvlbh"><legend id="qvlbh"></legend></address>
<samp id="qvlbh"><xmp id="qvlbh"><legend id="qvlbh"></legend>