Get a username formatted for a specific token version.
489628
def get_username(self):
        """"""
        _from = self.auth_context['from']
        if self.token_version == 1:
            return '{0}'.format(_from)
        elif self.token_version == 2:
            _user_type = self.auth_context['user_type']
            return '{0}/{1}/{2}'.format(
                self.token_version,
                _user_type,
                _from
            )
943300
def get_username(details, backend, response, *args, **kwargs):
    

    user = details.get('user')
    if not user:
        user_uuid = kwargs.get('uid')
        if not user_uuid:
            return

        username = uuid_to_username(user_uuid)
    else:
        username = user.username

    return {
        'username': username
    }
411156
def format(twt, idx = nil)
      idx = pad(idx) if idx
      text = deentitize(twt.text)
      if config.colors?
        buf = idx ? "#{idx.cyan}:" : ""
        if twt.as_user == config.account_name.to_s
          buf += "#{twt.as_user.bold.blue}: #{text}"
        elsif text.mentions?(config.account_name)
          buf += "#{twt.as_user.bold.red}: #{text}"
        else
          buf += "#{twt.as_user.bold.cyan}: #{text}"
        end
        buf.colorise!
      else
        buf = idx ? "#{idx}: " : ""
        buf += "#{twt.as_user}: #{text}"
      end
    end
354540
public String findUsername( String token ) {
		return token == null ? null : this.tokenToUsername.get( token );
	}
601182
def authenticate_credentials(self, payload):
        """"""
        username = payload.get('preferred_username') or payload.get('username')

        if username is None:
            raise exceptions.AuthenticationFailed('JWT must include a preferred_username or username claim!')
        else:
            try:
                user, __ = get_user_model().objects.get_or_create(username=username)
                attributes_updated = False
                for claim, attr in self.get_jwt_claim_attribute_map().items():
                    payload_value = payload.get(claim)

                    if getattr(user, attr) != payload_value and payload_value is not None:
                        setattr(user, attr, payload_value)
                        attributes_updated = True

                if attributes_updated:
                    user.save()
            except:
                msg = 'User retrieval failed.'
                logger.exception(msg)
                raise exceptions.AuthenticationFailed(msg)

        return user
1364309
def _prompt_username(prompt="Username: ", prefill=None):
    """"""
    if prefill:
        readline.set_startup_hook(lambda: readline.insert_text(prefill))

    try:
        return input(prompt).strip()
    except EOFError:
        print()
    finally:
        readline.set_startup_hook()
911115
def fullName(self):
        
        if self.givenName and self.sn:
            return "{0} {1}".format(self.givenName, self.sn)
        if self.givenName:
            return self.givenName
        if self.sn:
            return self.sn
        return self.uid
1290251
def Name(self):
        
        name = ""
        if self.Version:
            name = self.Version.UserAgent
        return name
465587
def get(self, username):
        
        if not self.remember:
            raise NotSaving

        if username not in self.token_storage:
            raise UserNotFound

        if self.token_storage[username]['expiration'] < time.time():
            new_token = self.refresh(self.token_storage[username]['refresh'])
            self.token_storage[username]['token'] = new_token[0]
            self.token_storage[username]['expiration'] = new_token[1]
            return new_token[0]
        else:
            return self.token_storage[username]['token']
459723
def _obtain_api_token(self, username, password):
        """"""
        data = self._request("POST", "auth/apitoken",
                             {"username": username, "password": password},
                             reestablish_session=False)
        return data["api_token"]
926212
def _get_user_id_from_name(self, context_id, user_name):
        """"""
        users = self.zap.users.users_list(context_id)
        for user in users:
            if user['name'] == user_name:
                return user['id']

        raise ZAPError('No user with the name "{0}"" was found for context {1}'.format(user_name, context_id))
1070232
def get_username(self, userid):
        '''
        '''

        username = self.user_map.get(userid)
        if not username:
            users = self.get_users()
            if users:
                members = {
                    m['id']: m['name']
                    for m in users.get('members', [{}])
                    if m.get('id')
                    and m.get('name')
                }
                if members:
                    self.user_map.update(members)

                username = self.user_map.get(userid, userid)

        return username
698835
def username_or(user, attr):
    
    if not settings.ACCOUNTS_NO_USERNAME:
        attr = "username"
    value = getattr(user, attr)
    if callable(value):
        value = value()
    return value
857326
def get_authuser_by_name(cls, request):
        
        username = authenticated_userid(request)
        if username:
            return cls.get_item(username=username)
386227
def _quote_username(name):
    '''
    
    '''
    if not isinstance(name, six.string_types):
        return str(name)  # future lint: disable=blacklisted-function
    else:
        return salt.utils.stringutils.to_str(name)
933163
def generate_token(self, username):
        
        serializer = self.get_signature()
        return serializer.dumps(
            {
                'username': username,
                'hashhash': self.get_hashhash(username)
            }
        ).decode('UTF-8')
732232
def _key(self, username, frozen=False):
        """"""
        if frozen:
            return self.frozen + username
        return self.prefix + username