Package net.oauth

Examples of net.oauth.OAuthMessage.addParameter()


          .setResponseString("some vague error")
          .create();
    }
    OAuthMessage msg = new OAuthMessage(null, null, null);
    msg.addParameter("oauth_problem", code);
    msg.addParameter("oauth_problem_advice", text);   
    return new HttpResponseBuilder()
        .setHttpStatusCode(HttpResponse.SC_FORBIDDEN)
        .addHeader("WWW-Authenticate", msg.getAuthorizationHeader("realm"))
        .create();
  }
View Full Code Here


    // Compute the hash of the body.
    byte[] rawBody = jsonBody.getBytes(UTF_8);
    byte[] hash = DigestUtils.sha(rawBody);
    byte[] encodedHash = Base64.encodeBase64(hash);
    message.addParameter(OAUTH_BODY_HASH, new String(encodedHash, UTF_8));

    // Add other parameters.

    message.addRequiredParameters(accessor);
    if (LOG.isLoggable(Level.FINE)) {
View Full Code Here

            MessageDigest md = MessageDigest.getInstance("SHA-1");

            byte[] hash = md.digest(requestBody.getBytes("UTF-8"));
            byte[] encodedHash = new Base64().encode(hash);

            message.addParameter("oauth_body_hash",
                new String(encodedHash, "UTF-8"));
          } catch (java.security.NoSuchAlgorithmException e) {
            // Ignore exception
          } catch (java.io.UnsupportedEncodingException e) {
            // Ignore exception
View Full Code Here

            // Ignore exception
          } catch (java.io.UnsupportedEncodingException e) {
            // Ignore exception
          }
        } else {
          message.addParameter(requestBody, "");
        }
      }

      try {
        message.addRequiredParameters(accessor);
View Full Code Here

          .setHttpStatusCode(rc)
          .setResponseString("some vague error")
          .create();
    }
    OAuthMessage msg = new OAuthMessage(null, null, null);
    msg.addParameter("oauth_problem", code);
    msg.addParameter("oauth_problem_advice", text);   
    return new HttpResponseBuilder()
        .setHttpStatusCode(rc)
        .addHeader("WWW-Authenticate", msg.getAuthorizationHeader("realm"))
        .create();
View Full Code Here

          .setResponseString("some vague error")
          .create();
    }
    OAuthMessage msg = new OAuthMessage(null, null, null);
    msg.addParameter("oauth_problem", code);
    msg.addParameter("oauth_problem_advice", text);   
    return new HttpResponseBuilder()
        .setHttpStatusCode(rc)
        .addHeader("WWW-Authenticate", msg.getAuthorizationHeader("realm"))
        .create();
  }
View Full Code Here

      // type. This support is deprecated and should be removed later.
      if (allowLegacyBodySigning &&
          (StringUtils.isEmpty(request.getContentType())  ||
          !request.getContentType().contains(OAuth.FORM_ENCODED))) {
        try {
          message.addParameter(readBodyString(request), "");
          return verifyMessage(message);
        } catch (OAuthProblemException ioe) {
          // ignore, let original exception be thrown
        } catch (IOException e) {
          // also ignore;
View Full Code Here

    // Compute the hash of the body.
    byte[] rawBody = jsonBody.getBytes(UTF_8);
    byte[] hash = DigestUtils.sha(rawBody);
    byte[] encodedHash = Base64.encodeBase64(hash);
    message.addParameter(OAUTH_BODY_HASH, new String(encodedHash, UTF_8));

    // Add other parameters.

    message.addRequiredParameters(accessor);
    LOG.info("Signature base string: " + OAuthSignatureMethod.getBaseString(message));
View Full Code Here

        Collections.<Entry<String, String>>emptyList());

    // Compute the hash of the body.
    byte[] hash = DigestUtils.sha(jsonBody);
    byte[] encodedHash = Base64.encodeBase64(hash, false);
    message.addParameter(OAUTH_BODY_HASH, new String(encodedHash, UTF_8));

    // Add other parameters.
    OAuthConsumer consumer = new OAuthConsumer(null, OAUTH_CONSUMER_KEY_DOMAIN + ":" + consumerKey,
        consumerSecret, null);
    consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, OAuth.HMAC_SHA1);
View Full Code Here

          .setHttpStatusCode(rc)
          .setResponseString("some vague error")
          .create();
    }
    OAuthMessage msg = new OAuthMessage(null, null, null);
    msg.addParameter("oauth_problem", code);
    msg.addParameter("oauth_problem_advice", text);   
    return new HttpResponseBuilder()
        .setHttpStatusCode(rc)
        .addHeader("WWW-Authenticate", msg.getAuthorizationHeader("realm"))
        .create();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.