Examples of GoogleOAuthParameters


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

    ////////////////////////////////////////////////////////////////////////////

    // You first need to initialize a few OAuth-related objects.
    // GoogleOAuthParameters holds all the parameters related to OAuth.
    // OAuthSigner is responsible for signing the OAuth base string.
    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

    // Set your OAuth Consumer Key (which you can register at
    // https://www.google.com/accounts/ManageDomains).
    oauthParameters.setOAuthConsumerKey(variables.getConsumerKey());

    // Initialize the OAuth Signer.  2-Legged OAuth must use HMAC-SHA1, which
    // uses the OAuth Consumer Secret to sign the request.  The OAuth Consumer
    // Secret can be obtained at https://www.google.com/accounts/ManageDomains.
    oauthParameters.setOAuthConsumerSecret(variables.getSignatureKey());
    OAuthSigner signer = new OAuthHmacSha1Signer();

    // Finally create a new GoogleOAuthHelperObject.  This is the object you
    // will use for all OAuth-related interaction.
    GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(signer);


    ////////////////////////////////////////////////////////////////////////////
    // STEP 3: Make a request to Google
    ////////////////////////////////////////////////////////////////////////////

    // Set the scope for this particular service.
    oauthParameters.setScope(variables.getScope());

    // Append the "xoauth_requestor_id" parameter to the feed url.  This
    // parameter indicates which user you are loading the data for.
    String feedUrlString = variables.getFeedUrl();
    feedUrlString += "?xoauth_requestor_id="
View Full Code Here

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

    public ProfilesManager(String consumerKey, String consumerSecret, String adminEmail)
        throws OAuthException {
      this.adminEmail = adminEmail;
      this.domain = adminEmail.substring(adminEmail.indexOf('@') + 1);

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

      this.myService = new ContactsService("GoogleInc-UnshareProfiles-1");
      this.myService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
    }
View Full Code Here

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

    ////////////////////////////////////////////////////////////////////////////

    // You first need to initialize a few OAuth-related objects.
    // GoogleOAuthParameters holds all the parameters related to OAuth.
    // OAuthSigner is responsible for signing the OAuth base string.
    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

    // Set your OAuth Consumer Key (which you can register at
    // https://www.google.com/accounts/ManageDomains).
    oauthParameters.setOAuthConsumerKey(variables.getConsumerKey());

    // Initialize the OAuth Signer.  If you are using RSA-SHA1, you must provide
    // your private key as a Base-64 string conforming to the PKCS #8 standard.
    // Visit http://code.google.com/apis/gdata/authsub.html#Registered to learn
    // more about creating a key/certificate pair.  If you are using HMAC-SHA1,
    // you must set your OAuth Consumer Secret, which can be obtained at
    // https://www.google.com/accounts/ManageDomains.
    OAuthSigner signer;
    switch (variables.getSignatureMethod()) {
      case RSA:
        signer = new OAuthRsaSha1Signer(variables.getSignatureKey());
        break;
      case HMAC:
        oauthParameters.setOAuthConsumerSecret(variables.getSignatureKey());
        signer = new OAuthHmacSha1Signer();
        break;
      default:
        throw new IllegalArgumentException("Invalid Signature Method");
    }

    // Finally create a new GoogleOAuthHelperObject.  This is the object you
    // will use for all OAuth-related interaction.
    GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(signer);


    ////////////////////////////////////////////////////////////////////////////
    // STEP 3: Get the Authorization URL
    ////////////////////////////////////////////////////////////////////////////

    // Set the scope for this particular service.
    oauthParameters.setScope(variables.getScope());

    // This method also makes a request to get the unauthorized request token,
    // and adds it to the oauthParameters object, along with the token secret
    // (if it is present).
    oauthHelper.getUnauthorizedRequestToken(oauthParameters);
View Full Code Here

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

    ////////////////////////////////////////////////////////////////////////////

    // You first need to initialize a few OAuth-related objects.
    // GoogleOAuthParameters holds all the parameters related to OAuth.
    // OAuthSigner is responsible for signing the OAuth base string.
    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

    // Set your OAuth Consumer Key (which you can register at
    // https://www.google.com/accounts/ManageDomains).
    oauthParameters.setOAuthConsumerKey(variables.getConsumerKey());

    // Initialize the OAuth Signer.  2-Legged OAuth must use HMAC-SHA1, which
    // uses the OAuth Consumer Secret to sign the request.  The OAuth Consumer
    // Secret can be obtained at https://www.google.com/accounts/ManageDomains.
    oauthParameters.setOAuthConsumerSecret(variables.getSignatureKey());
    OAuthSigner signer = new OAuthHmacSha1Signer();

    // Finally create a new GoogleOAuthHelperObject.  This is the object you
    // will use for all OAuth-related interaction.
    GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(signer);


    ////////////////////////////////////////////////////////////////////////////
    // STEP 3: Make a request to Google
    ////////////////////////////////////////////////////////////////////////////

    // Set the scope for this particular service.
    oauthParameters.setScope(variables.getScope());

    // Append the "xoauth_requestor_id" parameter to the feed url.  This
    // parameter indicates which user you are loading the data for.
    String feedUrlString = variables.getFeedUrl();
    feedUrlString += "?xoauth_requestor_id="
View Full Code Here

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

   * @return URL, that user must follow to start registration
   * @throws OAuthException
   */
  public String getUserAuthorizationUrl() throws OAuthException{
    GoogleOAuthHelper googleOAuthHelper = getOAuthHelper(true);
      GoogleOAuthParameters googleOAuthParameters = getOAuthParameter(true);
      googleOAuthHelper.getUnauthorizedRequestToken(googleOAuthParameters);
    String requestUrl = googleOAuthHelper.createUserAuthorizationUrl(googleOAuthParameters);
    return requestUrl;
  }
View Full Code Here

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

   * @throws OAuthException
   */
  public List<String> getAccessToken() throws OAuthException{
    List<String> accessTokenAndSecret = new ArrayList<String>();
    GoogleOAuthHelper googleOAuthHelper = getOAuthHelper(false);
      GoogleOAuthParameters googleOAuthParameters = getOAuthParameter(false);
    accessTokenAndSecret.add(googleOAuthHelper.getAccessToken(googleOAuthParameters));
    accessTokenAndSecret.add(googleOAuthParameters.getOAuthTokenSecret());
    return accessTokenAndSecret;
 
View Full Code Here

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

   * @param getNew if true, new OAuth Parameter will be returned, existing otherwise
   * @return OAuth Parameters with consumer key and consumer secret
   */
  private GoogleOAuthParameters getOAuthParameter(boolean getNew){
    if(getNew){
        oauthParameters = new GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
        oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
      } else {
        //NOTHING TO DO
      }
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));
  }
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.