Package com.google.api.client.http

Examples of com.google.api.client.http.BasicAuthentication


  private Credential createCredential() {
    return new Credential.Builder(BearerToken.queryParameterAccessMethod()).setTransport(
        new MockHttpTransport())
        .setJsonFactory(new MockJsonFactory())
        .setTokenServerUrl(TOKEN_SERVER_URL)
        .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
        .build()
        .setAccessToken(ACCESS_TOKEN)
        .setRefreshToken(REFRESH_TOKEN)
        .setExpirationTimeMilliseconds(EXPIRES_IN);
  }
View Full Code Here


    transport.statusCode = 500;
    Credential access =
        new Credential.Builder(BearerToken.queryParameterAccessMethod()).setTransport(transport)
            .setJsonFactory(JSON_FACTORY)
            .setTokenServerUrl(TOKEN_SERVER_URL)
            .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
            .build()
            .setExpiresInSeconds(3600L)
            .setAccessToken(ACCESS_TOKEN)
            .setRefreshToken(REFRESH_TOKEN);
View Full Code Here

    AuthorizationCodeFlow flow =
        new AuthorizationCodeFlow.Builder(BearerToken.queryParameterAccessMethod(),
            new AccessTokenTransport(),
            new JacksonFactory(),
            TOKEN_SERVER_URL,
            new BasicAuthentication(CLIENT_ID, CLIENT_SECRET),
            CLIENT_ID,
            "authorizationServerEncodedUrl").setCredentialCreatedListener(listener).build();
    assertFalse(listener.called);
    flow.createAndStoreCredential(new TokenResponse(), "userId");
    assertTrue(listener.called);
View Full Code Here

    AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken
        .queryParameterAccessMethod(),
        new AccessTokenTransport(),
        new JacksonFactory(),
        TOKEN_SERVER_URL,
        new BasicAuthentication(CLIENT_ID, CLIENT_SECRET),
        CLIENT_ID,
        "authorizationServerEncodedUrl").addRefreshListener(listener1)
        .addRefreshListener(listener2).build();
    TokenResponse tokenResponse = new TokenResponse();
    tokenResponse.setAccessToken(ACCESS_TOKEN);
View Full Code Here

    AuthorizationCodeFlow flow =
        new AuthorizationCodeFlow.Builder(BearerToken.queryParameterAccessMethod(),
            new AccessTokenTransport(),
            new JacksonFactory(),
            TOKEN_SERVER_URL,
            new BasicAuthentication(CLIENT_ID, CLIENT_SECRET),
            CLIENT_ID,
            "https://example.com").setScopes(scopes).build();

    AuthorizationCodeRequestUrl url = flow.newAuthorizationUrl();
    if (scopes.isEmpty()) {
View Full Code Here

  private Credential createCredential() {
    Credential access = new Credential.Builder(
        BearerToken.queryParameterAccessMethod()).setTransport(new AccessTokenTransport())
        .setJsonFactory(JSON_FACTORY)
        .setTokenServerUrl(TOKEN_SERVER_URL)
        .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
        .build()
        .setAccessToken(ACCESS_TOKEN)
        .setRefreshToken(REFRESH_TOKEN)
        .setExpirationTimeMilliseconds(EXPIRES_IN);
    return access;
View Full Code Here

  private Credential createEmptyCredential() {
    Credential access = new Credential.Builder(
        BearerToken.queryParameterAccessMethod()).setTransport(new AccessTokenTransport())
        .setJsonFactory(JSON_FACTORY)
        .setTokenServerUrl(TOKEN_SERVER_URL)
        .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
        .build();
    return access;
  }
View Full Code Here

      Credential.AccessMethod method, final CheckAuth checkAuth) throws Exception {
    final Credential credential =
        new Credential.Builder(method).setTransport(new AccessTokenTransport())
            .setJsonFactory(JSON_FACTORY)
            .setTokenServerUrl(TOKEN_SERVER_URL)
            .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
            .build()
            .setAccessToken(ACCESS_TOKEN)
            .setRefreshToken(REFRESH_TOKEN);
    class MyTransport extends MockHttpTransport {
      boolean resetAccessToken;
View Full Code Here

    AccessTokenTransport transport = new AccessTokenTransport();
    Credential access =
        new Credential.Builder(BearerToken.queryParameterAccessMethod()).setTransport(transport)
            .setJsonFactory(JSON_FACTORY)
            .setTokenServerUrl(TOKEN_SERVER_URL)
            .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
            .build()
            .setAccessToken(ACCESS_TOKEN);
    assertFalse(access.refreshToken());
    assertEquals(ACCESS_TOKEN, access.getAccessToken());
    assertNull(access.getRefreshToken());
View Full Code Here

    AccessTokenTransport transport = new AccessTokenTransport();
    Credential access =
        new Credential.Builder(BearerToken.queryParameterAccessMethod()).setTransport(transport)
            .setJsonFactory(JSON_FACTORY)
            .setTokenServerUrl(TOKEN_SERVER_URL)
            .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET))
            .build()
            .setRefreshToken(REFRESH_TOKEN)
            .setAccessToken(ACCESS_TOKEN);
    assertTrue(access.refreshToken());
    assertEquals(NEW_ACCESS_TOKEN, access.getAccessToken());
View Full Code Here

TOP

Related Classes of com.google.api.client.http.BasicAuthentication

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.