hi

 

The following code *should* work, but doesn't appear to (the user

cant login using the newly set credentials, to the slide web ui server).

 

Any ideas why ?  The test at the end of this sequence will throw a 401
exception.

 

 

      HttpURL slideSrv = new HttpURL(target);

      slideSrv.setUserinfo("root", "root");

      

      WebdavResource wdr = new WebdavResource(slideSrv);

      createCollection = "/slide/users/joe";

      boolean success = wdr.mkcolMethod( createCollection );

      if (success != true)

      {

        throw new EAMBaseException("Unable to create the new user.
(Webdav)");

      }

      

      // place the password by adding a property to this new collection

      String nextTarget = "/slide/users/joe";

      slideSrv = new HttpURL(nextTarget);

      slideSrv.setUserinfo("root", "root");

      wdr = new WebdavResource(slideSrv);  

      String nameSpaceUri = "http://jakarta.apache.org/slide/";;

      String localName    = "password";

      PropertyName propName = new PropertyName(nameSpaceUri, localName);

      success = wdr.proppatchMethod(target, propName, pwd, true);

      // success is true on return.

 

      // assign a role - type 'user'

      nextTarget = "/slide/roles/user";

      slideSrv = new HttpURL(nextTarget);

      slideSrv.setUserinfo("root", "root");

      wdr = new WebdavResource(slideSrv);

      String localname = "group-member-set";

      propName = new PropertyName("DAV:", localname);

      String propValue = "<D:href xmlns:D='DAV:'>/users/joe</D:href>";

      success = wdr.proppatchMethod( nextTarget, propName, propValue, true
);

      // success is true on return.

 

      // test it

      slideSrv = new HttpURL("http://localhost:8080/slide/files";);

      slideSrv.setUserinfo("joe", "password");

      wdr = new WebdavResource(slideSrv);

Reply via email to