org.scribe.model.Token.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中org.scribe.model.Token.isEmpty()方法的一些代码示例,展示了Token.isEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.isEmpty()方法的具体详情如下:
包路径:org.scribe.model.Token
类名称:Token
方法名:isEmpty

Token.isEmpty介绍

[英]Returns true if the token is empty (token = "", secret = "")
[中]如果令牌为空,则返回true(token=“”,secret=“”)

代码示例

代码示例来源:origin: jenkinsci/bitbucket-build-status-notifier-plugin

private FormValidation checkCredentials(UsernamePasswordCredentials credentials) {
    try {
      OAuthConfig config = new OAuthConfig(credentials.getUsername(), credentials.getPassword().getPlainText());
      BitbucketApiService apiService = (BitbucketApiService) new BitbucketApi().createService(config);
      Verifier verifier = null;
      Token token = apiService.getAccessToken(OAuthConstants.EMPTY_TOKEN, verifier);
      if (token.isEmpty()) {
        return FormValidation.error("Invalid Bitbucket OAuth credentials");
      }
    } catch (Exception e) {
      return FormValidation.error(e.getClass() + e.getMessage());
    }
    return FormValidation.ok();
  }
}

代码示例来源:origin: org.scribe/scribe-up

@Override
public void signRequest(final Token token, final OAuthRequest request) {
  this.config.log("signing request: " + request.getCompleteUrl());
  
  // Do not append the token if empty. This is for two legged OAuth calls.
  if (!token.isEmpty()) {
    request.addOAuthParameter(OAuthConstants.TOKEN, token.getToken());
  }
  this.config.log("setting token to: " + token);
  addOAuthParams(request, token);
  appendSignature(request);
}

代码示例来源:origin: org.scribe/scribe

/**
 * {@inheritDoc}
 */
public void signRequest(Token token, OAuthRequest request)
{
 config.log("signing request: " + request.getCompleteUrl());
 // Do not append the token if empty. This is for two legged OAuth calls.
 if (!token.isEmpty())
 {
  request.addOAuthParameter(OAuthConstants.TOKEN, token.getToken());
 }
 config.log("setting token to: " + token);
 addOAuthParams(request, token);
 appendSignature(request);
}

相关文章