0

我在使用 maven cargo 插件部署到托管的 tomcat 服务器时遇到问题。我了解服务器需要摘要式身份验证。我能够毫无问题地部署到我的香草测试服务器。

curl -u username --digest http://hostname/manager/text/list返回应用程序列表。

有没有我缺少的配置?

4

1 回答 1

0

Update: Cargo 1.4.10 added support for digest authentication.

I don't think so. I ran into the same problem with Jenkins' Deploy Plugin. After diving into the source AFAICT Cargo only supports Basic authentication for Tomcat: http://svn.codehaus.org/cargo/core/trunk/containers/tomcat/src/main/java/org/codehaus/cargo/container/tomcat/internal/TomcatManager.java

protected String invoke(String path, InputStream data) throws TomcatManagerException,
    IOException
{
    ...

    if (this.username != null)
    {
        String authorization = toAuthorization(this.username, this.password);
        connection.setRequestProperty("Authorization", authorization);
    }
    ...
/**
 * Gets the HTTP Basic Authorization header value for the supplied username and password.
 * 
 * @param username the username to use for authentication
 * @param password the password to use for authentication
 * @return the HTTP Basic Authorization header value
 */
private static String toAuthorization(String username, String password)
{
    StringBuilder buffer = new StringBuilder();
    buffer.append(username).append(':');
    if (password != null)
    {
        buffer.append(password);
    }
    return "Basic " + new String(Base64.encodeBase64(buffer.toString().getBytes()));
}

I'm guessing that this is because the connection is implemented with a plain HttpUrlConnection, so adding support for DIGEST would be a pain.

于 2014-07-09T19:02:30.993 回答