Use authentication during attachment handling

* The downloader/uploader was not using the username/password
* Also refactored a bunch to be able to follow command line parameter
* usage