You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Trevor Scroggins (JIRA)" <ji...@codehaus.org> on 2010/03/05 01:48:56 UTC

[jira] Issue Comment Edited: (MJAVADOC-270) NTLM Authentication doesn't seem to work

    [ http://jira.codehaus.org/browse/MJAVADOC-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=212768#action_212768 ] 

Trevor Scroggins edited comment on MJAVADOC-270 at 3/4/10 6:48 PM:
-------------------------------------------------------------------

NTLM authentication in org.apache.commons.httpclient requires an instance of org.apache.commons.httpclient.NTCredentials rather than org.apache.commons.httpclient.UsernamePasswordCredentials. Something like this may work in JavadocUtil.fetchURL():

{quote}
if ( StringUtils.isNotEmpty( activeProxy.getUsername() ) && activeProxy.getPassword() != null )
{
    if ( /* NTLM host */ != null && /* NTLM domain */ != null )
    {
        Credentials nTLMCredentials =
            new NTCredentials( activeProxy.getUsername(), activeProxy.getPassword(),
                               /* NTLM host */, /* NTLM domain */ );
        AuthScope authScope =
            new AuthScope( null, -1, null, "NTLM" );

        httpClient.getState().setProxyCedentials( authScope, nTLMCredentials );
    }

    Credentials anyCredentials =
        new UsernamePasswordCredentials( activeProxy.getUsername(), activeProxy.getPassword() );

    httpClient.getState().setProxyCredentials( AuthScope.ANY, anyCredentials );
}
{quote}

The "NTLM host" and "NTLM domain" settings would need to be intregrated with org.apache.maven.settings.Proxy and the command-line mangling methods supporting Javadoc.

      was (Author: tscroggins):
    NTLM authentication in org.apache.commons.httpclient requires an instance of org.apache.commons.httpclient.NTCredentials rather than org.apache.commons.httpclient.UsernamePasswordCredentials. Something like this may work in JavadocUtil.fetchURL():

if ( StringUtils.isNotEmpty( activeProxy.getUsername() ) && activeProxy.getPassword() != null )
{
    if ( /* NTLM host */ != null && /* NTLM domain */ != null )
    {
        Credentials nTLMCredentials =
            new NTCredentials( activeProxy.getUsername(), activeProxy.getPassword(),
                               /* NTLM host */, /* NTLM domain */ );
        AuthScope authScope =
            new AuthScope( null, -1, null, "NTLM" );

        httpClient.getState().setProxyCedentials( authScope, nTLMCredentials );
    }

    Credentials anyCredentials =
        new UsernamePasswordCredentials( activeProxy.getUsername(), activeProxy.getPassword() );

    httpClient.getState().setProxyCredentials( AuthScope.ANY, anyCredentials );
}

The "NTLM host" and "NTLM domain" settings would need to be intregrated with org.apache.maven.settings.Proxy and the command-line mangling methods supporting Javadoc.
  
> NTLM Authentication doesn't seem to work
> ----------------------------------------
>
>                 Key: MJAVADOC-270
>                 URL: http://jira.codehaus.org/browse/MJAVADOC-270
>             Project: Maven 2.x Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 2.6
>            Reporter: Martijn Verburg
>            Priority: Minor
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-javadoc-plugin</artifactId>
>         <configuration>
>             <additionalJOption>-J-Dhttp.auth.ntlm.domain=MIP-LONDON</additionalJOption>
>         </configuration>            
>       </plugin>
> Stack Trace:
> ---------------
> [INFO] Generating "JavaDocs" report.
> [WARNING] Source files encoding has not been set, using platform encoding ISO-8859-1, i.e. build is platform dependent!
> Oct 21, 2009 1:55:22 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
> INFO: ntlm authentication scheme selected
> Oct 21, 2009 1:55:22 PM org.apache.commons.httpclient.HttpMethodDirector authenticate
> SEVERE: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials
> org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials
>         at org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:332)
>         at org.apache.commons.httpclient.HttpMethodDirector.authenticateProxy(HttpMethodDirector.java:320)
>         at org.apache.commons.httpclient.HttpMethodDirector.authenticate(HttpMethodDirector.java:232)
>         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
>         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
>         at org.apache.maven.plugin.javadoc.JavadocUtil.fetchURL(JavadocUtil.java:773)
>         at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.isValidJavadocLink(AbstractJavadocMojo.java:4680)
>         at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.addLinkArguments(AbstractJavadocMojo.java:3229)
>         at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.addStandardDocletOptions(AbstractJavadocMojo.java:3885)
>         at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1761)
>         at org.apache.maven.plugin.javadoc.JavadocReport.generate(JavadocReport.java:122)
>         at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:139)
>         at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:269)
>         at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:101)
>         at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:133)
>         at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:100)
>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>         at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Oct 21, 2009 1:55:22 PM org.apache.commons.httpclient.HttpMethodDirector processProxyAuthChallenge
> INFO: Failure authenticating with NTLM <any realm>@prx:80
> [ERROR] Error fetching link: http://java.sun.com/j2se/1.5.0/docs/api/package-list. Ignored it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira