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.
978340
def _determine_auth_mechanism(username, password, delegation):
        
        if re.match('(.*)@(.+)', username) is not None:
            if delegation is True:
                raise Exception('Kerberos is not yet supported, specify the username in <domain>\<username> form for NTLM')
            else:
                raise Exception('Kerberos is not yet supported, specify the username in <domain>>\<username> form for NTLM')

        # check for NT format 'domain\username' a blank domain or username is invalid
        legacy = re.match('(.*)\\\\(.*)', username)
        if legacy is not None:
            if not legacy.group(1):
                raise Exception('Please specify the Windows domain for user in <domain>\<username> format')
            if not legacy.group(2):
                raise Exception('Please specify the Username of the user in <domain>\<username> format')
            if delegation is True:
                return HttpCredSSPAuth(legacy.group(1), legacy.group(2), password)
            else:
                return HttpNtlmAuth(legacy.group(1), legacy.group(2), password)

        #return HttpCredSSPAuth("SERVER2012", "Administrator", password)
        # attempt NTLM (local account, not domain) - if username is '' then we try anonymous NTLM auth
        # as if anyone will configure that - uf!
        return HttpNtlmAuth('', username, password)
809723
def token_header_name
      if SimpleTokenAuthentication.header_names["#{name_underscore}".to_sym].presence \
        && token_header_name = SimpleTokenAuthentication.header_names["#{name_underscore}".to_sym][:authentication_token]
        token_header_name
      else
        "X-#{name_underscore.camelize}-Token"
      end
    end
762500
def username(self, value=None):
        
        if value is not None:
            return URL._mutate(self, username=value)
        return unicode_unquote(self._tuple.username)
599050
def nickmask(prefix: str, kwargs: Dict[str, Any]) -> None:
    
    if "!" in prefix and "@" in prefix:
        # From a user
        kwargs["nick"], remainder = prefix.split("!", 1)
        kwargs["user"], kwargs["host"] = remainder.split("@", 1)
    else:
        # From a server, probably the host
        kwargs["host"] = prefix
1297468
def sign(post_body)
      custom_escape(Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, @secret_key, post_body)))
    end
1117639
def _get_user(self, username, attrs=ALL_ATTRS):
        """"""

        username = ldap.filter.escape_filter_chars(username)
        user_filter = self.user_filter_tmpl % {
            'username': self._uni(username)
        }
        r = self._search(self._byte_p2(user_filter), attrs, self.userdn)

        if len(r) == 0:
            return None

        # if NO_ATTR, only return the DN
        if attrs == NO_ATTR:
            dn_entry = r[0][0]
        # in other cases, return everything (dn + attributes)
        else:
            dn_entry = r[0]
        return dn_entry
813882
def _get_username_for_key(self):
        """"""
        response = self.client.get_access_key_last_used(
            AccessKeyId=self.compromised_resource['access_key_id']
        )
        username = response['UserName']
        return username
20101
private String toDN(String username)
	{
		String userDN = new StringBuilder(userDnPrefix).append(username).append(this.userDnSuffix).toString();
		return userDN;
	}
580386
def connection_key(self):
        
        return "{host}:{namespace}:{username}".format(host=self.host, namespace=self.namespace, username=self.username)
288738
def join_authority(authority):
    
    (user, passwd, host, port) = authority
    result = ''
    if user:
        result += user
        if passwd:
            result += ':' + passwd
        result += '@'
    result += host
    if port:
        result += ':' + port
    return result
931418
function username(value, fromIndex) {
  var index = fromIndex
  var length = value.length
  var size

  /* First character of username cannot be a dash. */
  if (value.charCodeAt(index) === CC_DASH) {
    return -1
  }

  while (index < length) {
    if (!usernameCharacter(value.charCodeAt(index))) {
      break
    }

    index++
  }

  size = index - fromIndex

  /* Last character of username can no longer be a dash, but could be (GH-13). */
  if (!size || size > MAX_USER_LENGTH) {
    return -1
  }

  return index
}
600254
def auth_tls(self, mount_point='cert', use_token=True):
        
        return self.login('/v1/auth/{0}/login'.format(mount_point), use_token=use_token)
643249
def get_web_auth_session_key_username(self, url, token=""):
        

        if url in self.web_auth_tokens.keys():
            token = self.web_auth_tokens[url]
        else:
            # This will raise a WSError if token is blank or unauthorized
            token = token

        request = _Request(self.network, "auth.getSession", {"token": token})

        # default action is that a request is signed only when
        # a session key is provided.
        request.sign_it()

        doc = request.execute()

        session_key = doc.getElementsByTagName("key")[0].firstChild.data
        username = doc.getElementsByTagName("name")[0].firstChild.data
        return session_key, username
802031
def username(self, value):
        """"""
        if isinstance(value, str):
            self._username = value
            self._handler = None
1205109
def cmd_ssh_user(tar_aminame, inst_name):
    
    if tar_aminame == "Unknown":
        tar_aminame = inst_name
    # first 5 chars of AMI-name can be anywhere in AMI-Name
    userlu = {"ubunt": "ubuntu", "debia": "admin", "fedor": "root",
              "cento": "centos", "openb": "root"}
    usertemp = ['name'] + [value for key, value in list(userlu.items())
                           if key in tar_aminame.lower()]
    usertemp = dict(zip(usertemp[::2], usertemp[1::2]))
    username = usertemp.get('name', 'ec2-user')
    debg.dprint("loginuser Calculated: ", username)
    return username
750384
def get_default_remote_name():
    
    s = u'%s@%s:%d'
    s %= (getpass.getuser(), socket.gethostname(), os.getpid())
    # In mixed UNIX/Windows environments, the username may contain slashes.
    return s.translate({
        ord(u'\\'): ord(u'_'),
        ord(u'/'): ord(u'_')
    })
809325
def telnet_login(
        self, username_pattern=r"(?:user>)", alt_prompt_term=r"#\s*$", **kwargs
    ):
        
        self.TELNET_RETURN = self.RETURN
        return super(RadETXTelnet, self).telnet_login(
            username_pattern=username_pattern,
            alt_prompt_terminator=alt_prompt_term,
            **kwargs
        )