PR: MPLINKCHECK-19
Using NTLM proxy git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@369155 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -24,6 +24,8 @@ maven.junit.sysproperties = \
|
||||
maven.proxy.port \
|
||||
maven.proxy.username \
|
||||
maven.proxy.password \
|
||||
maven.proxy.ntlm.host \
|
||||
maven.proxy.ntlm.domain \
|
||||
maven.mode.online
|
||||
|
||||
maven.jar.override = on
|
||||
|
||||
@@ -58,6 +58,10 @@ public final class LinkCheck
|
||||
|
||||
private static final long MEG = 1024 * 1024;
|
||||
|
||||
private static final String MAVEN_PROXY_NTLM_HOST = "maven.proxy.ntlm.host";
|
||||
|
||||
private static final String MAVEN_PROXY_NTLM_DOMAIN = "maven.proxy.ntlm.domain";
|
||||
|
||||
private File basedir;
|
||||
|
||||
private String cache;
|
||||
@@ -169,7 +173,9 @@ public final class LinkCheck
|
||||
if ( ctx.getOnline().booleanValue() )
|
||||
{
|
||||
lvm.addLinkValidator( new OnlineHTTPLinkValidator( ctx.getProxyHost(), ctx.getProxyPort(), ctx
|
||||
.getProxyUserName(), ctx.getProxyPassword() ) );
|
||||
.getProxyUserName(), ctx.getProxyPassword(), (String) ctx.getVariable( MAVEN_PROXY_NTLM_HOST ),
|
||||
(String) ctx
|
||||
.getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ package org.apache.maven.plugin.linkcheck.validation;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.commons.httpclient.Credentials;
|
||||
import org.apache.commons.httpclient.Header;
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
@@ -13,6 +14,7 @@ import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
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.HeadMethod;
|
||||
@@ -41,9 +43,14 @@ public final class OnlineHTTPLinkValidator
|
||||
|
||||
private String proxyPass;
|
||||
|
||||
private String proxyNtlmHost;
|
||||
|
||||
private String proxyNtlmDomain;
|
||||
|
||||
private transient HttpClient cl;
|
||||
|
||||
public OnlineHTTPLinkValidator( String proxyHost, String proxyPort, String proxyUser, String proxyPass )
|
||||
public OnlineHTTPLinkValidator( String proxyHost, String proxyPort, String proxyUser, String proxyPass,
|
||||
String proxyNtlmHost, String proxyNtlmDomain )
|
||||
{
|
||||
if ( proxyHost == null || proxyHost.trim().equals( "" ) )
|
||||
{
|
||||
@@ -67,6 +74,11 @@ public final class OnlineHTTPLinkValidator
|
||||
}
|
||||
this.proxyUser = proxyUser;
|
||||
this.proxyPass = proxyPass;
|
||||
if ( proxyNtlmHost != null && proxyNtlmHost.trim().equals( "" ) )
|
||||
{
|
||||
this.proxyNtlmHost = proxyNtlmHost;
|
||||
this.proxyNtlmDomain = proxyNtlmDomain;
|
||||
}
|
||||
}
|
||||
initHttpClient();
|
||||
}
|
||||
@@ -159,8 +171,17 @@ public final class OnlineHTTPLinkValidator
|
||||
{
|
||||
if ( LOG.isDebugEnabled() )
|
||||
LOG.debug( "Proxy User:" + proxyUser );
|
||||
state
|
||||
.setProxyCredentials( null, null, new UsernamePasswordCredentials( this.proxyUser, this.proxyPass ) );
|
||||
Credentials credentials;
|
||||
if ( this.proxyNtlmHost != null )
|
||||
{
|
||||
credentials = new NTCredentials( this.proxyUser, this.proxyPass, this.proxyNtlmHost,
|
||||
this.proxyNtlmDomain );
|
||||
}
|
||||
else
|
||||
{
|
||||
credentials = new UsernamePasswordCredentials( this.proxyUser, this.proxyPass );
|
||||
}
|
||||
state.setProxyCredentials( null, null, credentials );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ public class HTTPLinkValidatorTest
|
||||
{
|
||||
hlv = new OnlineHTTPLinkValidator( System.getProperty( "maven.proxy.host" ), System
|
||||
.getProperty( "maven.proxy.port" ), System.getProperty( "maven.proxy.username" ), System
|
||||
.getProperty( "maven.proxy.password" ) );
|
||||
.getProperty( "maven.proxy.password" ), System.getProperty( "maven.proxy.ntlm.host" ), System
|
||||
.getProperty( "maven.proxy.ntlm.domain" ) );
|
||||
|
||||
assertEquals( LinkValidationResult.VALID, checkLink( "http://www.apache.org" ).getStatus() );
|
||||
assertEquals( LinkValidationResult.ERROR, checkLink( "http://www.example.com>);" ).getStatus() );
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<action dev="aheritier" type="fix" issue="MPLINKCHECK-22">Sites requiring authentication are reported as NOT FOUND.</action>
|
||||
<action dev="aheritier" type="fix" issue="MPLINKCHECK-21">java.lang.NumberFormatException if proxy port is setted to ""</action>
|
||||
<action dev="aheritier" type="fix" issue="MPLINKCHECK-20" due-to="Ignacio G. Mac Dowell">StackOverflowError processing apidocs/index-all.html.</action>
|
||||
<action dev="aheritier" type="add" issue="MPLINKCHECK-19">Support NTLM proxies.</action>
|
||||
<action dev="aheritier" type="update" issue="MPLINKCHECK-10">"Moved Permanently" sites are reported as a warning and not as an error.</action>
|
||||
<action dev="aheritier" type="add">If maven is in offline mode the report doesn't test external urls. A warning is displayed in the report.</action>
|
||||
<action dev="brett" type="update">Make compatible with Maven 1.1</action>
|
||||
|
||||
Reference in New Issue
Block a user