@Override public String getOAuthRedirectUrl() { final String v = this.value("OAuth Redirect Url"); if(StringUtils.isBlank(v)) { return parent.getOAuthRedirectUrl(); } return v; }
@Override public Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); return new Client(configuration.build()); }
}.withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService);
@Override public RequestEntityRestStorageService connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); return new OAuth2RequestEntityRestStorageService(this, this.configure(), configuration); }
@Override protected DbxRawClientV2 connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); final CloseableHttpClient client = configuration.build(); return new CustomDbxRawClientV2(DbxRequestConfig.newBuilder(useragent.get()) .withAutoRetryDisabled() .withHttpRequestor(new DropboxCommonsHttpRequestExecutor(client)).build(), DbxHost.DEFAULT, null, null); }
@Override protected Drive connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); this.transport = new ApacheHttpTransport(configuration.build()); return new Drive.Builder(transport, json, new HttpRequestInitializer() { @Override public void initialize(HttpRequest request) { request.setSuppressUserAgentSuffix(true); // OAuth Bearer added in interceptor } }) .setApplicationName(useragent.get()) .build(); }
host).withRedirectUri(Scheme.isURL(host.getProtocol().getOAuthRedirectUrl()) ? host.getProtocol().getOAuthRedirectUrl() : new HostUrlProvider().withUsername(false).withPath(true).get( host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getOAuthRedirectUrl()) ); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService));