Uploaded image for project: 'Maven Wagon'
  1. Maven Wagon
  2. WAGON-309

NTLM for webdav behind IIS

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.0-beta-2
    • None
    • wagon-webdav
    • None
    • client: jdk1.5
      server: iis 6, tomcat 5.5 and ssl
    • Patch

    Description

      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.

      Attachments

        1. wagon-webdav.zip
          160 kB
          Alessandro Gerlinger Romero
        2. wagon-webdav.zip
          212 kB
          Alessandro Gerlinger Romero

        Activity

          People

            Unassigned Unassigned
            romgerale Alessandro Gerlinger Romero
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: