Fix for not having to set UI and X509_USER_PROXY.

This pull request replaces pull request #4083.
As stated in that old pull request, there is corresponding pull request for WMCore.