Working authentication

This works for basic auth but if you are using oauth it requires a patched JOSM and a custom oauth consumer key until I can get JOSM devs to do some things. 

Definitely still room for improvement, especially in the error handling though.