Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Proxy特性需求】代理 > 路径规则 > 临时令牌功能 #55

Open
jack3rpopov opened this issue Sep 21, 2019 · 1 comment
Open

Comments

@jack3rpopov
Copy link

image

访问控制,增加一个是否包含 referer [...文本框]
image

(界面可能如下)
令牌参数: staticToken (文本框)
令牌加密方式: DES cbc padding5 (下拉)
秘钥:我是8位秘钥 (文本框)
数据格式:JSON (下拉)
成功: $time 大于 now() 当年时间 (多个条件 + 类似现有功能js表达式)
$const 等于 常量baidu

—————————————————————————————————————

客户端访问静态文件
http://111.baidu.com/static/usetoken/1.jpg 直接代开错误403
带临时令牌打开
http://111.baidu.com/static/usetoken/1.jpg?staticToken=DJSHFDSHFJDSFJDSFDSDFS

令牌内容
DJSHFDSHFJDSFJDSFDSDFS
到达 TeaWeb》/static/usetoken/路径规则后》获取staticToken(参数TeaWeb设定),然后解密(根据设定的加密方式。)

得到明文

{"time":1569052354,"const":'baidu'}

根据成功规则去验证,成功打开,错误 403

—————————————————————————————————————
可实现

配合临时令牌和referer,
可以实现类似CDN临时令牌访问的功能,防盗链。即自建安全的静态服务器,下载服务器。
可实现API临时授权访问。

@jack3rpopov
Copy link
Author

补充一下。令牌计入文件缓存,如果消费过,则提示403。防止在会话时间内重复消费。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant