Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

LoginBySSPI to ESXi 5 host error

$
0
0

I've used the code below to connect to my vCenter (v 5) servers via SSPI however when I try to login to our ESXi (v 5) servers using the same method I get an InvalidLogin fault/error.   I assumed that a sspi login to the ESXi servers would be possible as I was guessing that the vSphere client did so.  If it is possible what could be causing my error?  Is there a different way it must be done or more that must be done for the ESXi servers?  Thanks for any and all help.

 

 

-Jimmy

 

 

private VimService _service;
private ServiceContent _sic;
private ManagedObjectReference _svcRef;

_svcRef = new ManagedObjectReference();
_svcRef.type = "ServiceInstance";_svcRef.Value = "ServiceInstance";


_service = new VimService();
_service.Url = url; //https://<server>/sdk
_service.Timeout = 600000;
_service.CookieContainer = new System.Net.CookieContainer();

_sic = _service.RetrieveServiceContent(_svcRef);

var ch = new SSPIHelper();
byte[] ct;
byte[] st = null;
bool cc;

ch.InitializeClient(out ct, st, out cc);
var ct_b64 = Convert.ToBase64String(ct);

try{
     _service.LoginBySSPI(_sic.sessionManager, ct_b64, null);
}
catch (SoapException ex)
{     object mf = GetMethodFault(ex);     if (mf is SSPIChallenge)     {          var sc = (SSPIChallenge)mf;          var st_b64 = sc.base64Token;          st = Convert.FromBase64String(st_b64);          ch.InitialzeClient(out ct, st, out cc);          ct_b64 = Convert.ToBase64String(ct);                   _service.LoginBySSPI(_sic.sessionManager, ct_b64, null);     }
}          

Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>