vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.21k stars 766 forks source link

Example of SSPI Login with SmartConnect #710

Open zdxerr opened 6 years ago

zdxerr commented 6 years ago

Can you please give an example of how to use SSPI Login with SmartConnect. What data should I write into the b64token?

surajano commented 6 years ago

@tianhao64, @hartsock Please help!!

tushartarkas commented 6 years ago

I'm interesting in the same as well. The problem statement that I'm working on is,

`// UserSessionService is available as injected Spring Service // Get UserSession Object UserSession userSession = userSessionService.getUserSession(); ServerInfo sInfo = userSession.serversInfo[0];

String sessionId = sInfo.sessionCookie;`

Every iteration gave an error "'Cannot complete login due to an incorrect user name or password."

The same code when used with mechanism=userpass and passing username and password works and returns instance of serviceInstance.

Is there something else, which needs to be configured before this method can be invoked?

The environment details for test are as below

gaurav-dalvi commented 5 years ago

I tried using this with token = vmware_soap_session=\"sometoken\" then getting base64encoding of token and using in SmartConnectNoSSL , It still asks for password. Using 6.7.0.2018.9 version.

mdonoughe commented 4 years ago

I don't know if this is all correct, but it worked for me:

import winkerberos as kerberos
from pyVim.connect import SmartConnectNoSSL

status, context = kerberos.authGSSClientInit('host@' + ADDRESS, gssflags=kerberos.GSS_C_MUTUAL_FLAG | kerberos.GSS_C_SEQUENCE_FLAG)
status = kerberos.authGSSClientStep(context, '')
response = kerberos.authGSSClientResponse(context)

session = SmartConnectNoSSL(host=ADDRESS, b64token=response, mechanism='sspi')
royling commented 4 years ago

Same question here, please help! @tianhao64

sownthararaj commented 2 years ago

Got any fix? @tushartarkas