@staticmethod<EOL><INDENT>def _determine_auth_mechanism(username, password, delegation):<DEDENT>
if re.match('<STR_LIT>', username) is not None:<EOL><INDENT>if delegation is True:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT><DEDENT>legacy = re.match('<STR_LIT>', username)<EOL>if legacy is not None:<EOL><INDENT>if not legacy.group(<NUM_LIT:1>):<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if not legacy.group(<NUM_LIT:2>):<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if delegation is True:<EOL><INDENT>return HttpCredSSPAuth(legacy.group(<NUM_LIT:1>), legacy.group(<NUM_LIT:2>), password)<EOL><DEDENT>else:<EOL><INDENT>return HttpNtlmAuth(legacy.group(<NUM_LIT:1>), legacy.group(<NUM_LIT:2>), password)<EOL><DEDENT><DEDENT>return HttpNtlmAuth('<STR_LIT>', username, password)<EOL>
if the username contains at '@' sign we will use kerberos
if the username contains a '/ we will use ntlm
either NTLM or Kerberos. In fact its basically always Negotiate.