Return username/password tuple, possibly prompting the user for them.
431005
def auth_pair(self, force_console=False):
        """"""
        if not self.auth_valid():
            self._get_auth(force_console)
        return (self.user, self.password)
676347
def get_user_creds(username, password):
    
    username = utils.first_true(
        [username, config["bel_api"]["servers"]["arangodb_username"]], default=""
    )
    password = utils.first_true(
        [password, config["secrets"]["bel_api"]["servers"].get("arangodb_password")],
        default="",
    )

    return username, password
527008
def get_random_user(self):
        
        c = self.db.cursor()
        c.execute('''SELECT username, password, fullname FROM users
                     WHERE rowid >= (abs(random()) % (SELECT max(rowid) FROM users))
                     LIMIT 1''')
        r = c.fetchone()
        return {"username": r[0], "password": r[1], "fullname": r[2]}
619781
def _determine_username(self, ip):
        """"""
        ssh = subprocess.Popen([
            "ssh",
            "-o", "UserKnownHostsFile=/dev/null",
            "-o", "StrictHostKeyChecking=no",
            "root@%s" % ip],
            stdin=subprocess.DEVNULL,
            stdout=subprocess.PIPE,
            stderr=subprocess.DEVNULL)
        first_line = ssh.stdout.readline()
        ssh.kill()
        ssh.wait()
        if first_line:
            match = re.search(
                r"Please login as the user \"(\w+)\" rather than "
                r"the user \"root\".", first_line.decode('utf-8'))
            if match:
                return match.groups()[0]
        else:
            return None
759307
def _get_auth(username, password):
    '''
    
    '''
    if username and password:
        return requests.auth.HTTPBasicAuth(username, password)
    else:
        return None
384990
def get_user(self):
        
        for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
            user = os.environ.get(name)
            if user:
                break     
        for u in users:
            if u['name'] == user:
                return u['type'], u['name']
144125
def get_login_credentials(args):
  
  if not args.username:
    args.username = raw_input("Enter Username: ")
  if not args.password:
    args.password = getpass.getpass("Enter Password: ")
446065
def _build_credentials_tuple(mech, source, user, passwd, extra):
    
    user = _unicode(user) if user is not None else None
    password = passwd if passwd is None else _unicode(passwd)
    if mech == 'GSSAPI':
        properties = extra.get('authmechanismproperties', {})
        service_name = properties.get('SERVICE_NAME', 'mongodb')
        canonicalize = properties.get('CANONICALIZE_HOST_NAME', False)
        service_realm = properties.get('SERVICE_REALM')
        props = GSSAPIProperties(service_name=service_name,
                                 canonicalize_host_name=canonicalize,
                                 service_realm=service_realm)
        # Source is always $external.
        return MongoCredential(mech, '$external', user, password, props)
    elif mech == 'MONGODB-X509':
        # user can be None.
        return MongoCredential(mech, '$external', user, None, None)
    else:
        if passwd is None:
            raise ConfigurationError("A password is required.")
        return MongoCredential(mech, source, user, password, None)
414386
def username(self):
        """"""
        if len(self._inp_username.value.strip()) == 0: # if username provided by user
            if not self.hostname is None:
                config = parse_sshconfig(self.hostname)
                if 'user' in config: # if username is present in the config file
                    return config['user']
            else:
                return None
        else:
            return self._inp_username.value
450064
def get_user_info(self, username):
        
        info = self.get_users_info([username])
        return info[username] if info is not None else None
761462
def check_credentials(self, username, password):
        
        return password is not None and self.credentials.get(username, None) == password
1337889
def _getUsername(self):
        
        for (l, d) in getAccountNames(self.store):
            return l + u'@' + d
1023604
def get_token_credentials(cls, username, request):
        
        try:
            user = cls.get_item(username=username)
        except Exception as ex:
            log.error(str(ex))
            forget(request)
        else:
            if user:
                return user.api_key.token
142833
def get_random_user(self):
        
        from provider.models import User
        u = User.objects.order_by('?')[0]
        return {"username": u.username, "password": u.password, "fullname": u.fullname}
732232
def _key(self, username, frozen=False):
        """"""
        if frozen:
            return self.frozen + username
        return self.prefix + username
49839
def get_credentials(username=None, password=None, netrc=None, use_keyring=False):
    
    if netrc:
        path = None if netrc is True else netrc
        return authenticate_through_netrc(path)

    if not username:
        raise CredentialsError(
            'Please provide a username with the -u option, '
            'or a .netrc file with the -n option.')

    if not password and use_keyring:
        password = keyring.get_password(KEYRING_SERVICE_NAME, username)

    if not password:
        password = getpass.getpass('Coursera password for {0}: '.format(username))
        if use_keyring:
            keyring.set_password(KEYRING_SERVICE_NAME, username, password)

    return username, password
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