[
https://issues.apache.org/jira/browse/WAGON-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16460147#comment-16460147
]
Alessandro Gerlinger Romero commented on WAGON-309:
---------------------------------------------------
It should be tested since the change was proposed almost 8 years ago.
> NTLM for webdav behind IIS
> --------------------------
>
> Key: WAGON-309
> URL: https://issues.apache.org/jira/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
> Fix For: waiting-for-feedback
>
> Attachments: wagon-webdav.zip, 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, "host.com", "host") ); }
> }
> - 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 was sent by Atlassian JIRA
(v7.6.3#76005)