刷新token的值

@param token 原来的toeken值
@return 刷新后的token值
433417
public JwtToken refreshToken(String token) {
        String refreshedToken;
        Date expireTime = generateExpirationDate();
        try {
            final Claims claims = getClaimsFromToken(token);
            claims.put(CLAIM_KEY_CREATED, expireTime.getTime());
            refreshedToken = build(claims, expireTime);
        } catch (Exception e) {
            log.error("refreshedToken jwt token error : {}", e.getMessage());
            refreshedToken = null;
        }
        return new JwtToken(refreshedToken, expireTime.getTime());
    }
52381
public Date getExpirationDateFromToken(String token) {
        Date expiration;
        try {
            final Claims claims = getClaimsFromToken(token);
            return claims.getExpiration();
        } catch (Exception e) {
            log.error("get expiration Time from jwt token error : {}", e.getMessage());
            return null;
        }
    }
545531
private String getRefreshToken(Token accessToken) {
    JSONObject rawJson = JSONObject.fromObject(accessToken.getRawResponse());
    return rawJson.getString("refresh_token");
  }
1104556
public PatternTokenBuilder csToken(String token) {
    this.token = Objects.requireNonNull(token);
    caseSensitive = true;
    return this;
  }
619674
public function setToken($token)
    {
        $token = trim($token);

        $this->isChanged('token', $token);

        $this->token = $token;

        return $this;
    }
419210
public Token add( String word ) {
        Token t = new Token(word);
        push( t );
        return t;
    }
255349
public function addToken($token)
    {
        if (!in_array($token, $this->tokens)) {
            $this->tokens[] = $token;
        }

        return $this;
    }
469769
public static String replaceCRToken(final String original) {
        String toReplace = original;

        if (original != null && original.indexOf(NEWLINE_TOKEN) >= 0) {
            toReplace = StringUtil.replace(NEWLINE_TOKEN, NEW_LINE, original);
        }

        return toReplace;
    }
679252
public synchronized byte[] response(byte[] token) {
    try {
      return saslClient != null ? saslClient.evaluateChallenge(token) : new byte[0];
    } catch (SaslException e) {
      throw Throwables.propagate(e);
    }
  }
245309
public function renewToken(?Token $token) : Token
    {
        if ($token === null) {
            throw new NullValueException("Token cannot be null");
        }

        $token->updateExisting([
            'token' => $this->generateToken($this->config->get('app.key')),
        ]);

        $this->fireUpdatedEvent($token->user, $token);

        return $token;
    }
455083
public PlatformResponse revokeToken(String token) throws ConnectionException {

        logger.debug("Enter OAuth2PlatformClient::revokeToken");
        
        PlatformResponse platformResponse = new PlatformResponse();
        try {
            
            HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig());
            Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint())
                                        .requiresAuthentication(true)
                                        .authString(getAuthHeader())
                                        .postParams(getUrlParameters("revoke", token, null))
                                        .build();

            Response response = client.makeRequest(request);
            
            logger.debug("Response Code : "+ response.getStatusCode());
            if (response.getStatusCode() != 200) {
                logger.debug("failed to revoke token");
                platformResponse.setStatus("ERROR");
                platformResponse.setErrorCode(response.getStatusCode() + "");
                platformResponse.setErrorMessage("Failed to revoke token");
                return platformResponse;
            }
            
            platformResponse.setStatus("SUCCESS");
            return platformResponse;
        }
        catch (Exception ex) {
            logger.error("Exception while calling revokeToken ", ex);
            throw new ConnectionException(ex.getMessage(), ex);
        }    
    }
38572
public static final void signAuthToken(AuthToken token) {
        String signature = generateSignature(token);
        token.setSignature(signature);
    }
1014715
def _new_token(self, chars=None, line_no=None):
        

        if not line_no:
            line_no = self._line_no

        if not chars:
            chars = self._token_chars

        if chars:
            # add new token
            self._tokens.append((line_no, ''.join(chars)))
            self._token_chars = []
616218
public static Jwt decode(String token) {
		int firstPeriod = token.indexOf('.');
		int lastPeriod = token.lastIndexOf('.');

		if (firstPeriod <= 0 || lastPeriod <= firstPeriod) {
			throw new IllegalArgumentException("JWT must have 3 tokens");
		}
		CharBuffer buffer = CharBuffer.wrap(token, 0, firstPeriod);
		// TODO: Use a Reader which supports CharBuffer
		JwtHeader header = JwtHeaderHelper.create(buffer.toString());

		buffer.limit(lastPeriod).position(firstPeriod + 1);
		byte[] claims = b64UrlDecode(buffer);
		boolean emptyCrypto = lastPeriod == token.length() - 1;

		byte[] crypto;

		if (emptyCrypto) {
			if (!"none".equals(header.parameters.alg)) {
				throw new IllegalArgumentException(
						"Signed or encrypted token must have non-empty crypto segment");
			}
			crypto = new byte[0];
		}
		else {
			buffer.limit(token.length()).position(lastPeriod + 1);
			crypto = b64UrlDecode(buffer);
		}
		return new JwtImpl(header, claims, crypto);
	}
122117
private HeaderCacheElement updateToken() {
    HeaderCacheElement newToken;
    try {
      LOG.info("Refreshing the OAuth token");
      newToken = new HeaderCacheElement(credentials.refreshAccessToken());
    } catch (Exception e) {
      LOG.warn("Got an unexpected exception while trying to refresh google credentials.", e);
      newToken = new HeaderCacheElement(
          Status.UNAUTHENTICATED
              .withDescription("Unexpected error trying to authenticate")
              .withCause(e)
      );
    }
    synchronized (lock) {
      // Update the token only if the new token is good or the old token is bad
      if (newToken.isValid() || !headerCache.isValid()) {
        headerCache = newToken;
      } else {
        LOG.warn("Failed to refresh the access token. Falling back to existing token. "
            + "New token state: {}, status: {}", newToken.getCacheState(), newToken.getToken().status);
      }
      futureToken = null;

      return headerCache;
    }
  }
1322681
public void removeToken(Object token) {

        m_tokens.remove(token);
        if (m_tokens.isEmpty()) {
            if (m_joinAction != null) {
                m_joinAction.run();
            }
        }
    }
1019751
private void parseToken(String token) {
        int len = token.length();

        for (int i = 0; i < len; i++) {
            int chr = sr.read();
            if (chr == -1) {
                throw new IllegalArgumentException("EOF reached while reading token: " + token);
            }
            chr = Character.toLowerCase((char)chr);
            int loTokenChar = token.charAt(i);

            if (loTokenChar != chr) {
                throw new IllegalArgumentException("Expected token: " + token + " at position " + sr.getPosition());
            }
        }
    }