NTLM for webdav behind IIS
--------------------------

                 Key: WAGON-309
                 URL: http://jira.codehaus.org/browse/WAGON-309
             Project: Maven Wagon
          Issue Type: Improvement
          Components: wagon-webdav
    Affects Versions: 1.0-beta-2
         Environment: client: jdk1.5
server: iis 6, tomcat 5.5 and ssl
            Reporter: Alessandro Gerlinger Romero
            Priority: Minor
         Attachments: wagon-webdav.zip

To use webdav over https with IIS 6, I changed two files to use NTCredentials. 
It is compatible with basic authentication.

-------
WebDavWagon.java
-------

        try
        {
            httpURL = urlToHttpURL( url );
/* - begin - before
            if ( hasAuthentication )
            {
                String userName = authenticationInfo.getUserName();
                String password = authenticationInfo.getPassword();

                if ( userName != null && password != null )
                {
                    //httpURL.setUserinfo( userName, password );
                        webdavResource.setCredentials( new 
NTCredentials(userName, password, "saows1701.accenture.com", "saows1701") );
                }
            }
  - end - before
*/
            CorrectedWebdavResource.setDefaultAction( 
CorrectedWebdavResource.NOACTION );
            webdavResource = new CorrectedWebdavResource( httpURL );

            // begin - after 
            if ( hasAuthentication )
            {
                String userName = authenticationInfo.getUserName();
                String password = authenticationInfo.getPassword();

                if ( userName != null && password != null )
                {

                    //httpURL.setUserinfo( userName, password );
                        webdavResource.setCredentials( new 
NTCredentials(userName, password, repository.getHost(), repository.getHost()) );
                }
            }
            // end - after 


-----------
CorrectedWebdavResource.java
-----------
    /**
     * FOWARD NTCREDENTIALS FOR EACH TRANSACTION
     * It is compatible with basic authentication.
     *
     * @see 
org.apache.webdav.lib.WebdavResource#generateTransactionHeader(org.apache.commons.httpclient.HttpMethod)
     */
    protected void generateTransactionHeader(HttpMethod method) {
        WebdavState state = (WebdavState) client.getState();

        String host = null;
        String realm = null;
        if ( hostCredentials instanceof NTCredentials){
                host = ((NTCredentials)hostCredentials).getHost();
                realm = ((NTCredentials)hostCredentials).getDomain();
        }

        state.setCredentials(realm, host, hostCredentials);
        super.generateTransactionHeader(method);
    }

*******
LIMITATIONS
*******
Uses host as realm.

-- 
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

        

Reply via email to