extract the real user from the given token string
6272
private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
    return authFactory.getUserFromToken(tokenStr);
  }
405857
function(token, cb){
      // deserialize the token iss
      var _iss = token.iss.split('|');

      waterlock.User.findOne(_iss[0]).exec(function(err, user){
        if(err){
          waterlock.logger.debug(err);
        }

        cb(err, user);
      });
    }
644050
def token(self) -> str:
        

        return self.value[0] if self in (Role.USER, Role.ROLE_REMOVE) else self.name
1340367
def tokenize(self):
        

        self.token_list = []
        ps = self.parse_string.strip()

        i = 0
        last_token = None

        while i < len(ps) and ps[i].isspace():
            i += 1

        while i < len(ps):
            token = ''

            if ps[i].isalpha():
                while i < len(ps) and (ps[i].isalnum() or ps[i] == '_'):
                    token += ps[i]
                    i += 1
            elif ps[i].isdigit():
                while i < len(ps) and (ps[i].isdigit() or
                                       ps[i] == '.' or
                                       ps[i] == 'e' or
                                       ps[i] == 'E' or
                                       (ps[i] == '+' and (ps[i-1] == 'e' or ps[i-1] == 'E')) or
                                       (ps[i] == '-' and (ps[i-1] == 'e' or ps[i-1] == 'E'))):
                    token += ps[i]
                    i += 1
            elif ps[i] == '.':
                if ps[i+1].isdigit():
                    while i < len(ps) and (ps[i].isdigit() or ps[i] == '.'):
                        token += ps[i]
                        i += 1
                else:
                    while i < len(ps) and (ps[i].isalpha() or ps[i] == '.'):
                        token += ps[i]
                        i += 1
            else:
                token += ps[i]
                i += 1

            if token == '-' and \
               (last_token == None or last_token == '(' or self.is_op(last_token)):
                token = '~'

            self.token_list += [token]
            last_token = token

            while i < len(ps) and ps[i].isspace():
                i += 1
1342736
def from_string(cls, string):
        """"""
        if string is None:
            string = ''

        if not isinstance(string, six.string_types):
            raise TypeError('string has to be a string type, got: {}'.format(type(string)))

        dictionary = {}
        tokens = [token.strip() for token in shlex.split(string)]

        def list_tuples(some_iterable):
            items, nexts = itertools.tee(some_iterable, 2)
            nexts = itertools.chain(itertools.islice(nexts, 1, None), [None])
            return list(zip(items, nexts))

        for token_current, token_next in list_tuples(tokens):

            # If current token starts with a dash, it is a value so we skip it
            if not token_current.startswith('-'):
                continue

            # If the next token is None or starts with a dash, the current token must be a flag, so the value is True
            if not token_next or token_next.startswith('-'):
                dictionary[token_current.lstrip('-')] = True

            # Otherwise the current token is an option with the next token being its value
            else:
                dictionary[token_current.lstrip('-')] = token_next

        return cls.from_dictionary(dictionary)
693198
function readNotifyUserAuth(message, tokens) {
	message.userName = protocol.decodeString(tokens[1]);
	message.userPassword = protocol.decodeString(tokens[3]);
	message.clientPrincipal = protocol.decodeString(tokens[5]);
	readNotifyUserHeaders(message, tokens.slice(6));
}
645630
public static String getUserNameFromToken(String authToken) {
        if (null == authToken) {
            return null;
        }

        return authToken.split(TOKEN_SEPARATOR)[0];
    }
696558
def parse_user(raw):
    
    nick = raw
    user = None
    host = None

    # Attempt to extract host.
    if protocol.HOST_SEPARATOR in raw:
        raw, host = raw.split(protocol.HOST_SEPARATOR)
    # Attempt to extract user.
    if protocol.USER_SEPARATOR in raw:
        nick, user = raw.split(protocol.USER_SEPARATOR)

    return nick, user, host
886447
static function parse_string( $src, $unicode = true, $parser = __CLASS__, $lexer = 'JTokenizer' ){
		$Tokenizer = new $lexer( false, $unicode);
		$tokens = $Tokenizer->get_all_tokens( $src );
		unset( $src );
		$Parser = new $parser;
		return $Parser->parse( $tokens );
	}
458581
@Override
    public String extractTokenFromContent(Context context) {
        // check query String
        String token = context.request().parameter(getTokenName());

        if (token == null) {
            // Check a specified header
            token = context.header(CSRF_TOKEN_HEADER);
        }

        // If still not found, check in body
        if (token == null) {
            if (context.request().contentType().startsWith(MimeTypes.FORM)
                    || context.request().contentType().startsWith(MimeTypes.MULTIPART)) {
                List<String> list = context.form().get(getTokenName());
                if (list != null && !list.isEmpty()) {
                    return list.get(0);
                }
            }
        }
        return token;
    }
424221
function fromHeaderOrQuerystring(req) {
  if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
    return req.headers.authorization.split(' ')[1];
  } else if (req.query && req.query.token) {
    return req.query.token;
  }
  return false;
}
244979
def get_user(self, validated_token):
        
        try:
            user_id = validated_token[api_settings.USER_ID_CLAIM]
        except KeyError:
            raise InvalidToken(_('Token contained no recognizable user identification'))

        try:
            user = User.objects.get(**{api_settings.USER_ID_FIELD: user_id})
        except User.DoesNotExist:
            raise AuthenticationFailed(_('User not found'), code='user_not_found')

        if not user.is_active:
            raise AuthenticationFailed(_('User is inactive'), code='user_inactive')

        return user
195006
def user_parse(data):
        """"""
        user_ = data.get('user', {})
        yield 'id', data.get('user_nsid') or user_.get('id')
        yield 'username', user_.get('username', {}).get('_content')
        first_name, _, last_name = data.get(
            'fullname', {}).get('_content', '').partition(' ')
        yield 'first_name', first_name
        yield 'last_name', last_name
327134
private function getSavedPasswordTokenData()
    {
        if ($this->isNewRecord()) {
            // We can't fulfil the request as we have no UserID which is required for the StringColumn.
            throw new TokenException("The user has not been saved");
        }

        return sha1($this->Username . $this->Password . $this->FullName . $this->Enabled . $this->UserID);
    }
987361
function parseAuthorization(header) {
  var token = header.split(/\s/).pop()
  var decoded = new Buffer(token, 'base64').toString()
  var components = decoded.split(':')
  if (components.length !== 2) {
    return false }
  else {
    return {
      user: components[0],
      password: components[1] } } }
494275
function extractToken(token) {
    var regex = /^Bearer\s(\S+)$/i;
    var result = regex.exec(token);
    return result ? result[1] : false;
}
572480
function getR1(token) {
    var match = token.match(/[aeiouyæåø]{1}[^aeiouyæåø]([A-Za-z0-9_æøåÆØÅäÄöÖüÜ]+)/);

    if (match) {
        var preR1Length = match.index + 2;

        if (preR1Length < 3 && preR1Length > 0) {
            return token.slice(3);
        } else if (preR1Length >= 3) {
            return match[1];
        } else {
            return token;
        }
    }

    return null;
}