请选择

Authentication Method A

Format of Authentication URL

http://Hostname/Filename?sign=timestamp-rand-uid-md5hash

Description of Authentication Fields

Field
Description
Hostname
Site acceleration domain name.
Path
Resource access path, which must start with / during authentication.
sign
User-defined authentication parameter name.
timestamp
Positive decimal integer Unix timestamp (the total number of seconds that have passed since 00:00:00, 1970.1.1 (UTC time), regardless of the time zone)
rand
A random string consisting of 0-100 characters, including uppercase and lowercase letters and numbers.
uid
User ID, which is currently unused and is 0 by default.
md5hash
A string containing 32 characters calculated based on the MD5 algorithm:
Algorithm: MD5 (Path-timestamp-rand-uid-key).
Authentication logic: If the request has not expired, the node will compare this string value with the md5hash value carried in the request URL. If the values are the same, the request will pass the authentication, and a response will be made to the request; if the values are different, the authentication will fail, and 403 will be returned.

Configuration Example

Assuming authentication method A is used for the requested URL https://www.example.com/foo.jpg, the configuration is as follows:


Getting Authentication Parameters

Path: /foo.jpg.
timestamp: The time when the server generates the authentication URL is 15:27:17, July 15, 2024 (UTC+8), the decimal (Unix timestamp) value of which is 1721028437.
rand: The random number generated is Kv4cPTAAP5YTi.
uid: 0.
Key: DvYmqE81E1F9R791H6lmht.
md5hash: MD5 (Path-timestamp-rand-uid-key)= MD5 (/foo.jpg-1721028437-Kv4cPTAAP5YTi-0-3C9mxSGzc8ZadmGNzE) = 0fbdca749d7ab784750685347e42075c.

Authentication URL Generated by a Client Request

https://www.example.com/foo.jpg?sign=1721028437-Kv4cPTAAP5YTi-0-0fbdca749d7ab784750685347e42075c.

Node Authentication

When the node server receives a client request via the encrypted URL, it will parse the timestamp parameter in the URL, and compare the sum of it and the configured validity period of ''1 second'' with the current time:
1. If the current time is after the ''timestamp + validity period'' time, it indicates that the request has expired, and 403 will be returned directly. If the current time is before the ''timestamp + validity period'' time, it indicates that the request has not expired, and the node server will go to step 2.
2. The node server calculates the md5hash value based on the obtained authentication parameters and compares it with the md5hash value carried in the request URL. If the values are the same, the request will pass the authentication, and a response will be made to the request; if the values are different, the authentication will fail, and 403 will be returned.