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

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

本文整理了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

  1. private FormValidation checkCredentials(UsernamePasswordCredentials credentials) {
  2. try {
  3. OAuthConfig config = new OAuthConfig(credentials.getUsername(), credentials.getPassword().getPlainText());
  4. BitbucketApiService apiService = (BitbucketApiService) new BitbucketApi().createService(config);
  5. Verifier verifier = null;
  6. Token token = apiService.getAccessToken(OAuthConstants.EMPTY_TOKEN, verifier);
  7. if (token.isEmpty()) {
  8. return FormValidation.error("Invalid Bitbucket OAuth credentials");
  9. }
  10. } catch (Exception e) {
  11. return FormValidation.error(e.getClass() + e.getMessage());
  12. }
  13. return FormValidation.ok();
  14. }
  15. }

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

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

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void signRequest(Token token, OAuthRequest request)
  5. {
  6. config.log("signing request: " + request.getCompleteUrl());
  7. // Do not append the token if empty. This is for two legged OAuth calls.
  8. if (!token.isEmpty())
  9. {
  10. request.addOAuthParameter(OAuthConstants.TOKEN, token.getToken());
  11. }
  12. config.log("setting token to: " + token);
  13. addOAuthParams(request, token);
  14. appendSignature(request);
  15. }

相关文章