From 9085bf2e192088900c46b4111186b2d74419563c Mon Sep 17 00:00:00 2001 From: ltheussl Date: Mon, 30 Jan 2006 20:44:09 +0000 Subject: [PATCH] PR: MPJIRA-10 Jira plugin does not work with NTLM proxy. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@373582 13f79535-47bb-0310-9956-ffa450edef68 --- jira/plugin.jelly | 2 ++ jira/plugin.properties | 2 ++ .../org/apache/maven/jira/JiraDownloader.java | 22 ++++++++++++++-- jira/xdocs/changes.xml | 1 + jira/xdocs/properties.xml | 25 +++++++++++++++++-- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/jira/plugin.jelly b/jira/plugin.jelly index 83a9ab77..a0b01b79 100644 --- a/jira/plugin.jelly +++ b/jira/plugin.jelly @@ -72,6 +72,8 @@ webPassword="${maven.jira.webPassword}" jiraUser="${maven.jira.jiraUser}" jiraPassword="${maven.jira.jiraPassword}" + proxyNtlmHost="${maven.jira.proxy.ntlm.host}" + proxyNtlmDomain="${maven.jira.proxy.ntlm.domain}" component="${maven.jira.component}" roadmap="${maven.jira.roadmap}" /> diff --git a/jira/plugin.properties b/jira/plugin.properties index c152a672..33ecb432 100644 --- a/jira/plugin.properties +++ b/jira/plugin.properties @@ -19,6 +19,8 @@ # ------------------------------------------------------------------- maven.jira.webUser= maven.jira.webPassword= +maven.jira.proxy.ntlm.host=${maven.proxy.ntlm.host} +maven.jira.proxy.ntlm.domain=${maven.proxy.ntlm.domain} maven.jira.jiraUser= maven.jira.jiraPassword= maven.jira.nbentries=1000 diff --git a/jira/src/main/org/apache/maven/jira/JiraDownloader.java b/jira/src/main/org/apache/maven/jira/JiraDownloader.java index 6c998cd6..7b7064ca 100644 --- a/jira/src/main/org/apache/maven/jira/JiraDownloader.java +++ b/jira/src/main/org/apache/maven/jira/JiraDownloader.java @@ -35,6 +35,7 @@ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpState; import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NTCredentials; import org.apache.commons.httpclient.StatusLine; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.methods.GetMethod; @@ -121,6 +122,12 @@ public final class JiraDownloader /** The password to LOG into webserver. */ private String webPassword; + /** The host to use if you are using NTLM authentication. */ + private String proxyNtlmHost; + + /** The NT domain to use if you are using NTLM authentication. */ + private String proxyNtlmDomain; + /** The maven project. */ private Project project; @@ -352,6 +359,7 @@ public final class JiraDownloader Number fixforNumber = nf.parse( projectPage, new ParsePosition( fixforIndex + 7 ) ); String fixfor = Integer.toString( fixforNumber.intValue() ); + // TODO: check if fixfor = -1: no versions scheduled in roadmap setFilter( "&&fixfor=" + fixfor + "&sorter/field=status&sorter/order=ASC" ); @@ -392,8 +400,18 @@ public final class JiraDownloader { client.getState().setAuthenticationPreemptive( true ); - Credentials defaultcreds = - new UsernamePasswordCredentials( webUser, webPassword ); + Credentials defaultcreds; + if ( this.proxyNtlmHost != null && this.proxyNtlmDomain != null) + { + defaultcreds = + new NTCredentials( webUser, webPassword, + proxyNtlmHost, proxyNtlmDomain ); + } + else + { + defaultcreds = + new UsernamePasswordCredentials( webUser, webPassword ); + } LOG.info( "Using username: " + webUser + " for Basic Authentication against the webserver at " diff --git a/jira/xdocs/changes.xml b/jira/xdocs/changes.xml index 9060d3ff..8156919a 100644 --- a/jira/xdocs/changes.xml +++ b/jira/xdocs/changes.xml @@ -24,6 +24,7 @@ + Jira plugin does not work with NTLM proxy. Upgrade to HttpClient 3.0. Plugin uses deprecated API to retrieve JIRA issues. Now requires at least JIRA 3.3. Add a jira-roadmap report. diff --git a/jira/xdocs/properties.xml b/jira/xdocs/properties.xml index ae55b3fe..076b9d18 100644 --- a/jira/xdocs/properties.xml +++ b/jira/xdocs/properties.xml @@ -129,7 +129,7 @@ Yes

- Defines the jira username for authentication into a private Jira instalation.
+ Defines the jira username for authentication into a private Jira instalation.

@@ -149,7 +149,7 @@ Yes

- Defines the http user for basic authentication into the Jira webserver.
+ Defines the http user for basic authentication into the Jira webserver.

@@ -164,6 +164,27 @@ + + maven.jira.proxy.ntlm.host + Yes + +

+ The host to use if you are using NTLM authentication +

+ + ${maven.proxy.ntlm.host} + + + maven.jira.proxy.ntlm.domain + Yes + +

+ The NT domain to use if you are using NTLM authentication. +

+ + ${maven.proxy.ntlm.domain} + + maven.jira.roadmap Yes