Package com.google.api.client.googleapis.auth.oauth2

Examples of com.google.api.client.googleapis.auth.oauth2.GoogleCredential.intercept()


    HttpRequest request = transport.createRequestFactory().buildRequest("get", null, null);

    assertTrue(wrapper.createScopedRequired());
    try {
      wrapper.intercept(request);
      fail("Should not be able to use credential without scopes.");
    } catch (Exception expected) {
    }
    assertEquals(appIdentity.getGetAccessTokenCallCount(), 1);
View Full Code Here


    }
    assertEquals(appIdentity.getGetAccessTokenCallCount(), 1);

    GoogleCredential scopedWrapper = wrapper.createScoped(SCOPES);
    assertNotSame(wrapper, scopedWrapper);
    scopedWrapper.intercept(request);

    assertEquals(appIdentity.getGetAccessTokenCallCount(), 2);
    HttpHeaders headers = request.getHeaders();
    String authHeader = headers.getAuthorization();
    assertTrue(authHeader.contains(expectedAccessToken));
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.