_ks_cached_user_id can be initialized with different value due to blocking call in json_request. It can cause infinite recursion. Avoid global variable and recursive function
Merge pull request #441 from Juniper/vnc_auth

Fix for 2610