Update controller.py to support v4 authentication

Changed controller.py to support authentication for v4 servers. Works with version 4.2.0