我可以使用HTTP标头中的HTTP基本身份验证凭据从Sonatype Nexus下载文件。
但是我无法通过将凭据作为URL的一部分来实现这一点 - 这样的事情:
http://admin:admin123@nexus.example.com/nexus/service/local/artifact/maven/content?g=com.test&a=project&v=1.0&r=test_repo_1_release
有没有人知道为什么或如何在标题中不使用auth来实现同样的目标?
PS:这是一个测试环境 - 因此没有SSL。
答案 0 :(得分:6)
您必须使用授权标头,因此您需要使用可以设置authorizaiton http标头的客户端。如果你有curl或wget可用,你可以这样做:
curl -u admin:admin123 http://nexus.example.com/nexus/service/local/artifact/maven/content?g=com.test&a=project&v=1.0&r=test_repo_1_release
wget --user = admin --password = admin123 http://nexus.example.com/nexus/service/local/artifact/maven/content?g=com.test&a=project&v=1.0&r=test_repo_1_release