Comments (6)
这个需求可能是需要“对使用AnyProxy的用户做权限控制”。我觉得这个优先级不高。
from anyproxy.
Hi @Vbubblery
请问这里面的用户验证是不是指header中的authorization?
如果是header中的信息,目前直接放入header中就可以使用,如果是想在rule中拦截并加入验证信息,应该可以自己对rule进行二次开发,所以可否描述一下用户验证的使用场景?
实现basic author重写了beforeSendRequest 方法:
*beforeSendRequest (requestDetail) {
console.log(requestDetail._req.headers);
if (!requestDetail || !requestDetail._req.headers || !requestDetail._req.headers["Proxy-Authorization"]) {
return {
response: {
statusCode: 407,
header: {
'Proxy-Authenticate': 'Basic'
}
}
};
}
}
该方法http请求可以验证身份,但是HTTPS请求出错了
其中beforeDealHttpsRequest方法如下:
*beforeDealHttpsRequest(requestDetail) {
console.log(requestDetail._req.headers);
return true;
},
from anyproxy.
Hi,
this is my code for Basic Auth, I am getting an error message "Send final response failed:Can not read property 'transfer-encoding' of undefined"
can anyone help me with the authentication!!!! pls
-
beforeSendRequest(requestDetail) {
const Base64 = require('js-base64').Base64; if (!requestDetail || !requestDetail._req.headers || !requestDetail._req.headers["Proxy-Authorization"]) { return { response: { statusCode: 407, header: { 'Proxy-Authenticate': 'Basic' } } }; } else { let auth = requestDetail._req.headers["Proxy-Authorization"]; auth = auth.split(" "); auth = Base64.decode(auth[1]); auth = auth.split(":"); let username = auth[0]; let password = auth[1]; if (username === "dawood" && password === "google123") { return { response: { statusCode: 200, } }; }}
from anyproxy.
Hi @Vbubblery
请问这里面的用户验证是不是指header中的authorization?
如果是header中的信息,目前直接放入header中就可以使用,如果是想在rule中拦截并加入验证信息,应该可以自己对rule进行二次开发,所以可否描述一下用户验证的使用场景?
from anyproxy.
@ottomao 我也有这个需求,原因是代理开在服务器上面,如果没有 basic auth,这个代理就很容易被别人扫到。
from anyproxy.
@ottomao 兄弟,可以讲讲实现的思路吗?我自己实现试试。
from anyproxy.
Related Issues (20)
- 在代理一段时间后,代理失效
- 页面打开报错:Failed to load latest log
- can look respose body HOT 1
- Post request http 2 response not supported
- 开发团队你们好,想请教一下响应数据转换乱码问题
- How do I get the IP address of the request side
- 抓取https请求时 无法获取客户端真实ip地址
- http2 support for anyproxy
- YN0002: │ anyproxy@npm:4.1.3 doesn't provide react (p233ec), requested by svg-inline-react
- 运行 anyproxy --intercept 时报错 throw er; // Unhandled 'error' even
- 未抓取到埋点请求,一个断裂的gif文件 HOT 1
- anyproxy与SwitchyOmega配合怎么获取翻墙的数据包 HOT 1
- iOS 手机连接代理 没有网络! HOT 2
- 怎么开启到一个指定IP
- 请教一下,怎么从源代码启动anyproxy呢
- 请更换安全的证书
- Check the proxy page
- 文档域名过期
- 抓包信息无法查看响应BODY
- Anyproxy 的 requestBody 和 downloadBody 提供了一个错误的数据 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anyproxy.