I spent the past 3 days trying to workout why all of the sudden my tms imagery provider is giving me 401s. I finally came across this open bug report http://josm.openstreetmap.de/ticket/8050 This bug still exists today in build 5759 when using a tms or wms server with http basic authentication.
Temp hacky fix: I had to setup a mapproxy server just to hand over the credentials, but for some reason it won't let me zoom past 19.
I discovered the problem after using Fiddler and no Authorization: Basic was sent in the request.
If anyone has a solution to please let me know.