All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scribe.services.PlaintextSignatureService Maven / Gradle / Ivy

There is a newer version: 1.3.7
Show newest version
package org.scribe.services;

import org.scribe.exceptions.*;
import org.scribe.utils.*;

/**
 * plaintext implementation of {@SignatureService}
 *
 * @author Pablo Fernandez
 *
 */
public class PlaintextSignatureService implements SignatureService
{
  private static final String METHOD = "PLAINTEXT";

  /**
   * {@inheritDoc}
   */
  public String getSignature(String baseString, String apiSecret, String tokenSecret)
  {
    try
    {
      Preconditions.checkEmptyString(apiSecret, "Api secret cant be null or empty string");
      return OAuthEncoder.encode(apiSecret) + '&' + OAuthEncoder.encode(tokenSecret);
    }
    catch (Exception e)
    {
      throw new OAuthSignatureException(baseString, e);
    }
  }

  /**
   * {@inheritDoc}
   */
  public String getSignatureMethod()
  {
    return METHOD;
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy