Generic token getter for all the providers
433929
def token_getter(provider, token=None):
        
        session_key = provider + '_token'
        if token is None:
            token = session.get(session_key)
        return token
549990
def match_token(token, tok_type, tok_str=None):
  """"""
  return token.type == tok_type and (tok_str is None or token.string == tok_str)
1373643
def get_token(self, code, headers=None, **kwargs):
        
        self._check_configuration("site", "token_url", "redirect_uri",
                                  "client_id", "client_secret")
        url = "%s%s" % (self.site, quote(self.token_url))
        data = {
            'redirect_uri': self.redirect_uri,
            'client_id': self.client_id,
            'client_secret': self.client_secret,
            'code': code,
        }
        data.update(kwargs)

        return self._make_request(url, data=data, headers=headers)
778472
private void findTokens() {
        mergedTokens = new TokenList();
        variable = null;
        state = TokenizerState.START;
        index = -1;

        while (index < rawTokens.length) {
            switch (state) {
            case START:
                next(TokenizerState.OUTSIDE_VARIABLE_CONTEXT);
                break;
            case OUTSIDE_VARIABLE_CONTEXT:
                handleTokenOutsideOfVariableContext();
                break;
            case INSIDE_VARIABLE_CONTEXT:
                handleTokenInsideOfVariableContext();
                break;
            default:
                break;
            }
        }
    }
656341
def token(self, adata, load):
        '''
        
        '''
        try:
            token = self.loadauth.get_tok(load['token'])
        except Exception as exc:
            log.error('Exception occurred when generating auth token: %s', exc)
            yield {}
        if not token:
            log.warning('Authentication failure of type "token" occurred.')
            yield {}
        for sub_auth in adata:
            for sub_adata in adata:
                if token['eauth'] not in adata:
                    continue
            if not ((token['name'] in adata[token['eauth']]) |
                    ('*' in adata[token['eauth']])):
                continue
            yield {'sub_auth': sub_auth, 'token': token}
        yield {}
943133
def get_token(code, token_service, client_id, client_secret, redirect_uri,
              grant_type):
  """"""
  data = {
      'code': code,
      'client_id': client_id,
      'client_secret': client_secret,
      'redirect_uri': redirect_uri,
      'grant_type': grant_type,
  }
  # Get the default http client
  resp = requests.post(token_service, data, verify=False)
  return resp.json()
1061015
public Class<? extends AccessTokenProvider> getAccessTokenProviderClass(Configuration config) {
    return config.getClass(
        configPrefix + ACCESS_TOKEN_PROVIDER_IMPL_SUFFIX, null, AccessTokenProvider.class);
  }
17659
function(tokenService, domainPrefix) {
  var tokenUrl = tokenService.replace(/\{DOMAIN_PREFIX\}/, domainPrefix);
  log.debug('token Url: '+ tokenUrl);
  return tokenUrl;
}
294990
def get_token_stream(source: str) -> CommonTokenStream:
    
    lexer = LuaLexer(InputStream(source))
    stream = CommonTokenStream(lexer)
    return stream
1180254
void getTokensFromTokenEndpoint() throws SocialLoginException {
        try {
            tokens = getTokensUsingAuthzCode();
        } catch (Exception e) {
            throw createExceptionAndLogMessage(e, "AUTH_CODE_ERROR_GETTING_TOKENS", new Object[] { socialConfig.getUniqueId(), e.getLocalizedMessage() });
        }
    }
867092
def get_oauth_token_key_name(self, provider):
        
        for _provider in self.oauth_providers:
            if _provider["name"] == provider:
                return _provider.get("token_key", "oauth_token")
142729
def _BuildToken(self, request, execution_time):
    """"""
    token = access_control.ACLToken(
        username=request.user,
        reason=request.args.get("reason", ""),
        process="GRRAdminUI",
        expiry=rdfvalue.RDFDatetime.Now() + execution_time)

    for field in ["Remote_Addr", "X-Forwarded-For"]:
      remote_addr = request.headers.get(field, "")
      if remote_addr:
        token.source_ips.append(remote_addr)
    return token
836400
def api(name, url, token, **kwargs):
    """"""
    return Client(token).api(name, url, **kwargs)
654397
static Iterator<Token> tokenize(ConfigOrigin origin, Reader input, ConfigSyntax flavor) {
        return new TokenIterator(origin, input, flavor != ConfigSyntax.JSON);
    }
667829
@Get("/tokens")
    public CompletableFuture<Collection<Token>> listTokens(User loginUser) {
        if (loginUser.isAdmin()) {
            return mds.getTokens()
                      .thenApply(tokens -> tokens.appIds().values());
        } else {
            return mds.getTokens()
                      .thenApply(Tokens::withoutSecret)
                      .thenApply(tokens -> tokens.appIds().values());
        }
    }
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;
        }
    }
1026233
static Token getInverseOperator(Token type) {
    switch (type) {
      case GT:
        return Token.LT;
      case LT:
        return Token.GT;
      case GE:
        return Token.LE;
      case LE:
        return Token.GE;
      default:
        throw new IllegalArgumentException("Unexpected token: " + type);
    }
  }