We're updating the issue view to help you get more done. 

Add support for DIGEST authentication to remote HTTP deployments on Tomcat

Description

When I tried to use the Jenkins deploy plugin to deploy a WAR to a Tomcat 7 instance protected by DIGEST authentication it failed to do so with the error:

1 2 3 Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://somewhere.internal.invalid:8080/manager/text/list at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:544)

I dug into the source code on the trunk and discovered that the TomcatManager class only supports BASIC HTTP authentication:

TomcatManager.java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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())); }

Could support for DIGEST authentication be added? I realize that this may require using another library to actually handle the DIGEST connection.

Status

Assignee

Savas Ali Tokmen

Reporter

John Gibson

Components

Fix versions

Priority

Major