@Test public void testConnect() throws Exception { session.close(); final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore() { @Override public String getPassword(final Scheme scheme, final int port, final String hostname, final String user) { if(user.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Access Token")) { return System.getProperties().getProperty("google.accesstoken"); } if(user.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Refresh Token")) { return System.getProperties().getProperty("google.refreshtoken"); } return null; } }, new DisabledProgressListener()); login.check(session, PathCache.empty(), new DisabledCancelCallback()); }
@Override public Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); this.transport = new ApacheHttpTransport(configuration.build()); final UseragentProvider ua = new PreferencesUseragentProvider(); return new Storage.Builder(transport, new JacksonFactory(), new UserAgentHttpRequestInitializer(ua)) .setApplicationName(ua.get()) .build(); }
GoogleStorageSession extends HttpSession<Storage> { @Override public Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); this.transport = new ApacheHttpTransport(configuration.build()); final UseragentProvider ua = new PreferencesUseragentProvider(); return new Storage.Builder(transport, new JacksonFactory(), new UserAgentHttpRequestInitializer(ua)) .setApplicationName(ua.get()) .build(); } }
GoogleStorageSession extends HttpSession<Storage> { @Override public Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); this.transport = new ApacheHttpTransport(configuration.build()); final UseragentProvider ua = new PreferencesUseragentProvider(); return new Storage.Builder(transport, new JacksonFactory(), new UserAgentHttpRequestInitializer(ua)) .setApplicationName(ua.get()) .build(); } GoogleStorageSession(final Host host, final X509TrustManager trust, final X509KeyManager key); }
GoogleStorageSession extends HttpSession<Storage> { @Override public Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); this.transport = new ApacheHttpTransport(configuration.build()); final UseragentProvider ua = new PreferencesUseragentProvider(); return new Storage.Builder(transport, new JacksonFactory(), new UserAgentHttpRequestInitializer(ua)) .setApplicationName(ua.get()) .build(); } GoogleStorageSession(final Host host, final X509TrustManager trust, final X509KeyManager key); @Override Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt,
                      final CancelCallback cancel); HttpClient getHttpClient(); @Override @SuppressWarnings("unchecked") T _getFeature(final Class<T> type); }
GoogleStorageSession extends HttpSession<Storage> { @Override public Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); this.transport = new ApacheHttpTransport(configuration.build()); final UseragentProvider ua = new PreferencesUseragentProvider(); return new Storage.Builder(transport, new JacksonFactory(), new UserAgentHttpRequestInitializer(ua)) .setApplicationName(ua.get()) .build(); } GoogleStorageSession(final Host host, final X509TrustManager trust, final X509KeyManager key); @Override Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt,
                      final CancelCallback cancel); HttpClient getHttpClient(); @Override @SuppressWarnings("unchecked") T _getFeature(final Class<T> type);  }