问题描述
我在执行来自 newman 的邮递员集合时遇到问题,这涉及加载 pfx 证书以建立 TLSMA 连接。
从 Postman 应用程序中,证书已正确加载(从设置中)并用于域 https://domain1.com 以与 TLSMA 对应服务器连接。
当我导出 json 集合和环境时,没有提及关联的域和证书。
检查 json 架构 here newman 接受请求中的证书定义,但应用它不起作用,这里是我的示例:
"request": {
"method": "GET","header": [],"certificate": {
"name": "Dev or Test Server","matches": ["https://domain1.com/*"],"cert": { "src": "./certificate.pfx" }
},"url": {
"raw": "https://domain1.com/as/authorization.oauth2","host": ["https://domain1.com"],"path": ["as","authorization.oauth2"],"query": [
{
我还尝试在具有以下内容的外部文件 cert-list.json 中应用证书配置:
[{
"name": "Dev or Test Server","cert": { "src": "./certificate-t.pfx" }
}]
但它也不起作用。
这里是 newman 命令:
newman run domain.postman_collection.json -n 1 --ssl-client-cert-list cert-list.json -e env.postman_environment.json -r cli --verbose
你知道我哪里做错了吗?
解决方法
将证书更改为 pfx 试试:
[{
"name": "Dev or Test Server","matches": ["https://domain1.com/*"],"pfx": { "src": "./certificate-t.pfx" }
}]