Examples of GoogleOAuthParameters


Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

      } else {
          System.out.println("Invalid credentials");
          return;
      }
            // We are using Google oauth API to call the service
            GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

            // Setting user name as consumer key
            oauthParameters.setOAuthConsumerKey(USER_NAME);
            // Setting above assigned consumer secret
            oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);

            // We will be using HMAC-SHA1 signature. Google API has a class to do that
            OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();

            // Create a Google service. The name of the current application given here
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

public class OAuthService {

    public boolean isOAuthConsumerValid(OAuthConsumerDTO oauthConsumer) throws Exception {
        GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(oauthConsumer.getOauthConsumerKey());
        oauthParameters.setOAuthConsumerSecret(getOAuthSecretKey(oauthConsumer
                .getOauthConsumerKey()));
        oauthParameters.setOAuthNonce(oauthConsumer.getOauthNonce());
        oauthParameters.setOAuthTimestamp(oauthConsumer.getOauthTimeStamp());
        oauthParameters.setOAuthSignatureMethod(oauthConsumer.getOauthSignatureMethod());
        OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
        String baseString = OAuthUtil.getSignatureBaseString(oauthConsumer.getBaseString(),
                oauthConsumer.getHttpMethod(), oauthParameters.getBaseParameters());
        String signature = signer.getSignature(baseString, oauthParameters);

        if (signature != null
                && URLEncoder.encode(signature).equals(oauthConsumer.getOauthSignature())) {
            return true;
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

      }

      URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/default/thin");
      GoogleService service = new ContactsService("step2");

      GoogleOAuthParameters params = new GoogleOAuthParameters();
      params.setOAuthConsumerKey(accessor.consumer.consumerKey);
      params.setOAuthConsumerSecret(accessor.consumer.consumerSecret);
      params.setOAuthToken(accessor.accessToken);
      params.setOAuthTokenSecret(accessor.tokenSecret);

      OAuthSigner signer = new OAuthHmacSha1Signer();

      service.setOAuthCredentials(params, signer);
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

  public static AuthManager getOauthManager() {
    return new AuthManager(
        UserServiceFactory.getUserService(),
        new AuthorizationServiceOauthImpl(
            GoogleDataManager.GOOGLE_DATA_SCOPE,
            new GoogleOAuthParameters()),
        new TokenDaoJdoImpl(PMF.getInstance()));
  }
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

            PMF.getInstance()),
        new AnalyticsServiceWrapper(
            new AnalyticsService(applicationName),
            new AuthorizationServiceOauthImpl(
                GoogleDataManager.GOOGLE_DATA_SCOPE,
                new GoogleOAuthParameters()),
            tableId, startDate, endDate));
  }
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

        super.init(config);

        String consumerKey = getInitParameter("consumer_key");
        String consumerSecret = getInitParameter("consumer_secret");

        GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(consumerKey);
        oauthParameters.setOAuthConsumerSecret(consumerSecret);
        System.out.println(consumerKey + " " + consumerSecret);
        oauthParameters.setOAuthType(OAuthParameters.OAuthType.TWO_LEGGED_OAUTH);
        calendarService = new CalendarService("marketplace-hello");
        try {
            calendarService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
        } catch (OAuthException e) {
            throw new ServletException("Unable to initialize calendar service", e);
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

        super.init(config);

        String consumerKey = getInitParameter("consumer_key");
        String consumerSecret = getInitParameter("consumer_secret");

        GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(consumerKey);
        oauthParameters.setOAuthConsumerSecret(consumerSecret);

        calendarService = new CalendarService("marketplace-hello");
        try {
            calendarService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
        } catch (OAuthException e) {
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

     * @see GAuthUpgradeBinding
     * @see GAuthServiceImpl
     */
    public void process(Exchange exchange) throws Exception {
        if (getEndpoint().getName() == AUTHORIZE) {
            GoogleOAuthParameters params = getAuthorizeBinding().writeRequest(getEndpoint(), exchange, null);
            getEndpoint().getService().getUnauthorizedRequestToken(params);
            getAuthorizeBinding().readResponse(getEndpoint(), exchange, params);
        } else {
            GoogleOAuthParameters params = getUpgradeBinding().writeRequest(getEndpoint(), exchange, null);
            getEndpoint().getService().getAccessToken(params);
            getUpgradeBinding().readResponse(getEndpoint(), exchange, params);
        }
       
    }
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

        }
        String scope = exchange.getIn().getHeader(GAUTH_SCOPE, String.class);
        if (scope == null) {
            scope = endpoint.getScope();
        }
        request = new GoogleOAuthParameters();
        request.setOAuthConsumerKey(endpoint.getConsumerKey());
        request.setOAuthConsumerSecret(endpoint.getConsumerSecret());
        request.setOAuthCallback(callback);
        request.setScope(scope);
        return request;
View Full Code Here

Examples of com.google.gdata.client.authn.oauth.GoogleOAuthParameters

     *             if the {@link GAuthComponent} is configured to use the
     *             HMAC_SHA1 signature method but there's no cookie with the
     *             request token secret.
     */
    public GoogleOAuthParameters writeRequest(GAuthEndpoint endpoint, Exchange exchange, GoogleOAuthParameters request) throws Exception {
        request = new GoogleOAuthParameters();
        request.setOAuthConsumerKey(endpoint.getConsumerKey());
        request.setOAuthConsumerSecret(endpoint.getConsumerSecret());
        request.setOAuthToken(exchange.getIn().getHeader("oauth_token", String.class));
        request.setOAuthVerifier(exchange.getIn().getHeader("oauth_verifier", String.class));

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.