Package com.google.api.client.json.jackson

Examples of com.google.api.client.json.jackson.JacksonFactory


        if (emailMap.containsKey(apiKey)){
            return emailMap.get(apiKey);
        }

        HttpTransport httpTransport = new NetHttpTransport();
        JacksonFactory jsonFactory = new JacksonFactory();
        GoogleCredential credential = getCredentials(apiKey);
        String emailAddress = null;

        try{
            Plus plus = new Plus(httpTransport, jsonFactory, credential);
View Full Code Here


    }

    private Gmail getGmailService(ApiKey apiKey) throws UpdateFailedException{
        HttpTransport httpTransport = new NetHttpTransport();
        JacksonFactory jsonFactory = new JacksonFactory();
        GoogleCredential credential = getCredentials(apiKey);
        return new Gmail(httpTransport, jsonFactory, credential);
    }
View Full Code Here

    log.info("code=" + code);

    log.info("clientId=" + clientId + ", clientSecret=" + clientSecret + ", code=" + code
        + ", callbackUrl=" + callbackUrl);
    GoogleAuthorizationCodeGrant authRequest = new GoogleAuthorizationCodeGrant(
        new UrlFetchTransport(), new JacksonFactory(), clientId, clientSecret, code, callbackUrl);

    AccessTokenResponse authResponse;
    try {
      authResponse = authRequest.execute();
    } catch (IOException e) {
View Full Code Here

      @Flag(FlagName.OAUTH_CLIENT_SECRET) String clientSecret,
      UserContext userContext) {
    this.userContext = userContext;
    this.accessThing = new GoogleAccessProtectedResource(
        getCredentials().getAccessToken(),
        new UrlFetchTransport(), new JacksonFactory(), clientId, clientSecret,
        getCredentials().getRefreshToken());
  }
View Full Code Here

  public static Credential getComputeEngineCredential()
      throws GeneralSecurityException, IOException {
    NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    try {
      // Try to connect using Google Compute Engine service account credentials.
      ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());
      // Force token refresh to detect if we are running on Google Compute Engine.
      credential.refreshToken();
      return credential;
    } catch (IOException e) {
      return null;
View Full Code Here

   * @return valid credentials or {@code null}
   */
  public static Credential getServiceAccountCredential(String account, String privateKeyFile)
      throws GeneralSecurityException, IOException {
    NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    JacksonFactory jsonFactory = new JacksonFactory();
    return new GoogleCredential.Builder()
        .setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountId(account)
        .setServiceAccountScopes(DatastoreOptions.SCOPES)
View Full Code Here

  public ModelAndView handleOauthResponse(
      @RequestParam(value = "code") String code,
      HttpServletRequest request) {
    logger.info("Oauth response code is: " + code);
    HttpTransport httpTransport = new NetHttpTransport();
    JacksonFactory jsonFactory = new JacksonFactory();
    ModelAndView mv = new ModelAndView();
    try {
      AccessTokenResponse googleResponse = new GoogleAuthorizationCodeGrant(
          httpTransport, jsonFactory, clientId, clientSecret, code,
          redirectUrl).execute();
View Full Code Here

private static String CLIENT_SECRET = "noZR-2HQmQiwYNPQ1rzOhfxE"
private static String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";   
public static void main(String[] args) throws IOException {   
 
  HttpTransport httpTransport = new NetHttpTransport();   
  JsonFactory jsonFactory = new JacksonFactory();      
  GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(       
      httpTransport, jsonFactory, CLIENT_ID, CLIENT_SECRET, Arrays.asList(DriveScopes.DRIVE))       
  .setAccessType("online")       
  .setApprovalPrompt("auto").build();       
  String url = flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI).build();   
View Full Code Here

  public OAuthRequestHelper(String clientId, String clientSecret, UserContext userContext) {
    this.userContext = userContext;
    this.accessThing = new GoogleAccessProtectedResource(
        getCredentials().getAccessToken(),
        new ApacheHttpTransport(), new JacksonFactory(), clientId, clientSecret,
        getCredentials().getRefreshToken());
  }
View Full Code Here

  private static String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";

  public static void main(String[] args) throws Exception {
    HttpTransport httpTransport = new NetHttpTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    GoogleClientSecrets clientSecrets =
        GoogleClientSecrets.load(
            jsonFactory,
            new InputStreamReader(AccessTokenGeneratorApplication.class
                .getResourceAsStream(CLIENTSECRETS_LOCATION)));
View Full Code Here

TOP

Related Classes of com.google.api.client.json.jackson.JacksonFactory

Copyright © 2018 www.massapicom. 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.