either return token from the Bearer, Bearer <token>, or false if malformed
494275
function extractToken(token) {
    var regex = /^Bearer\s(\S+)$/i;
    var result = regex.exec(token);
    return result ? result[1] : false;
}
378470
private Claims getClaimsFromToken(String token) {
        Claims claims;
        try {
            claims = Jwts.parser()
                    .setSigningKey(jwtProperties.getSecret())
                    .parseClaimsJws(token)
                    .getBody();
        } catch (Exception e) {
            log.error("get claims from jwt token error : {}", e.getMessage());
            claims = null;
        }
        return claims;
    }
532082
def _oauth_tokengetter(token=None):
    
    token = session.get("oauth")
    log.debug("Token Get: {0}".format(token))
    return token
682783
def get_token_payload(token)

        # Attempt to decode without verifying. May raise DecodeError.
        decoded = JWT.decode token, nil, false
        payload = decoded[0]

        # At this point, we know that the token is not expired and
        # well formatted. Find out if the payload is well defined.
        if payload.nil?
          # :nocov:
          logger.error("Token payload is nil: #{token}")
          raise UNAUTHORIZED_ERROR, "Invalid token"
          # :nocov:
        end

        return payload

      rescue JWT::DecodeError => e
        logger.error("Token decode error: #{e.message}")
        raise UNAUTHORIZED_ERROR, "Invalid token"
      end
550191
def mk_token(self, load):
        '''
        
        '''
        token = self.loadauth.mk_token(load)
        if not token:
            log.warning('Authentication failure of type "eauth" occurred.')
            return ''
        return token
131036
function(req){
    var token = null;
    if (req.headers && req.headers.authorization) {
      var parts = req.headers.authorization.split(' ');
      if (parts.length === 2){
        var scheme = parts[0];
        var credentials = parts[1];

        if (/^Bearer$/i.test(scheme)){
           token = credentials;
        }
      }
    }else{
      token = this.allParams(req).access_token;
    }
    return token;
  }
618908
def _good_token(self, token, offset, start=None):
        """"""
        if start is None:
            start = self.offset
        try:
            comment_index = self.source.rindex('#', start, offset)
        except ValueError:
            return True
        try:
            new_line_index = self.source.rindex('\n', start, offset)
        except ValueError:
            return False
        return comment_index < new_line_index
882507
function isURL(token) {
  try {
    if (!validProtocols.test(token)) {
      return false;
    }
    new URL(token);
    return true;
  } catch (e) {
    return false;
  }
}
236787
def get_auth_token(cls):
        
        if 'Authorization' not in f_request.headers:
            raise ValueError("Missing Authorization Bearer in headers")
        data = f_request.headers['Authorization'].encode('ascii', 'ignore')
        return str.replace(str(data), 'Bearer ', '').strip()
973104
def check_input(self, token):
        
        if token is None:
            raise Exception(self.full_name + ": No token provided!")
        if isinstance(token.payload, str):
            return
        raise Exception(self.full_name + ": Unhandled class: " + classes.get_classname(token.payload))
485584
def save_token(self, token, request, *args, **kwargs):
        
        return self.save_bearer_token(token, request, *args, **kwargs)
832416
def check_input(self, token):
        
        if token is None:
            raise Exception(self.full_name + ": No token provided!")
        if not isinstance(token.payload, Instances):
            raise Exception(self.full_name + ": Not an Instances object!")
130250
function (token) {
	if (!token) {
		return '';
	}
	if (typeof token === 'string') {
		return token;
	}
	if (typeof token.content === 'string') {
		return token.content;
	}
	return token.content.map(stringifyToken).join('');
}
169503
function checkCollabServerToken(authorization) {
		if (authorization.substr(0, 7) !== "Bearer ") {
			return false;
		}
		try {
			var decoded = jwt.verify(authorization.substr(7), options.configParams.get("orion.jwt.secret"));
			return true;
		} catch (ex) {
			return false;
		}
	}
782565
def check_input(self, token):
        
        if token is None:
            raise Exception(self.full_name + ": No token provided!")
        if isinstance(token.payload, Instances):
            return
        if isinstance(token.payload, Instance):
            return
        raise Exception(self.full_name + ": Unhandled class: " + classes.get_classname(token.payload))
1028036
public static String getProtocolByToken(String token, boolean returnDefault) {
        if (StringUtils.isEmpty(token) && returnDefault) {
            return JaxWsConstants.SOAP11HTTP_BINDING;
        }

        if (JaxWsConstants.SOAP11_HTTP_TOKEN.equals(token)) {
            return JaxWsConstants.SOAP11HTTP_BINDING;
        } else if (JaxWsConstants.SOAP11_HTTP_MTOM_TOKEN.equals(token)) {
            return JaxWsConstants.SOAP11HTTP_MTOM_BINDING;
        } else if (JaxWsConstants.SOAP12_HTTP_TOKEN.equals(token)) {
            return JaxWsConstants.SOAP12HTTP_BINDING;
        } else if (JaxWsConstants.SOAP12_HTTP_MTOM_TOKEN.equals(token)) {
            return JaxWsConstants.SOAP12HTTP_MTOM_BINDING;
        } else if (JaxWsConstants.XML_HTTP_TOKEN.equals(token)) {
            return JaxWsConstants.HTTP_BINDING;
        } else {
            return token;
        }
    }
424575
def _raise_on_unsupported_token(self, request):
        """"""
        if (request.token_type_hint and
            request.token_type_hint in self.valid_token_types and
            request.token_type_hint not in self.supported_token_types):
            raise UnsupportedTokenTypeError(request=request)