def get_gssapi_token(principal, host, domain):
 if (not HAS_GSSAPI):
  raise ImportError('The gssapi library is not imported.')
 service = '{0}/{1}@{2}'.format(principal, host, domain)
 log.debug('Retrieving gsspi token for service {0}'.format(service))
 service_name = gssapi.Name(service, gssapi.C_NT_USER_NAME)
 ctx = gssapi.InitContext(service_name)
 in_token = None
 while (not ctx.established):
  out_token = ctx.step(in_token)
  if out_token:
   encoded_token = base64.b64encode(out_token)
   return encoded_token
  if ctx.established:
   break
  if (not in_token):
   raise salt.exceptions.CommandExecutionError("Can't receive token, no response from server")
 raise salt.exceptions.CommandExecutionError("Context established, but didn't receive token")

def get_gssapi_token ( principal , host , domain ) : if ( not HAS_GSSAPI ) : raise ImportError ( 'The gssapi library is not imported.' ) service = '{0}/{1}@{2}' . format ( principal , host , domain ) log . debug ( 'Retrieving gsspi token for service {0}' . format ( service ) ) service_name = gssapi . Name ( service , gssapi . C_NT_USER_NAME ) ctx = gssapi . InitContext ( service_name ) in_token = None while ( not ctx . established ) : out_token = ctx . step ( in_token ) if out_token : encoded_token = base64 . b64encode ( out_token ) return encoded_token if ctx . established : break if ( not in_token ) : raise salt . exceptions . CommandExecutionError ( "Can't receive token, no response from server" ) raise salt . exceptions . CommandExecutionError ( "Context established, but didn't receive token" )
get the gssapi token for kerberos connection principal the service principal host host url where we would like to authenticate domain kerberos user domain .