diff --git a/Changelog.txt b/Changelog.txt index 013d96c2196..ebcdced3c4e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,12 @@ Cyberduck https://cyberduck.io/ +8.7.0 + +8.6.3 +- [Bugfix] Failure configuring credentials from AWS CLI setup (S3) (#14970) +- [Bugfix] Frequent broken pipe errors (FTP) (#14969) + 8.6.2 - [Feature] Allow to open connections without copying authentication code after login (Microsoft OneDrive, Sharepoint) - [Bugfix] Segmented downloads with multiple connections per file causes transfers to fail (#13374) diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxSession.java b/box/src/main/java/ch/cyberduck/core/box/BoxSession.java index 3081c282bd2..13b5c8ef6cc 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxSession.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxSession.java @@ -24,6 +24,8 @@ import ch.cyberduck.core.box.io.swagger.client.ApiException; import ch.cyberduck.core.box.io.swagger.client.api.UsersApi; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.AttributesFinder; import ch.cyberduck.core.features.Copy; import ch.cyberduck.core.features.Delete; @@ -64,9 +66,9 @@ public BoxSession(final Host host, final X509TrustManager trust, final X509KeyMa } @Override - public CloseableHttpClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) { + public CloseableHttpClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); - authorizationService = new OAuth2RequestInterceptor(configuration.build(), host) + authorizationService = new OAuth2RequestInterceptor(configuration.build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/core/src/main/java/ch/cyberduck/core/Profile.java b/core/src/main/java/ch/cyberduck/core/Profile.java index 5056d6b7785..dd1539f61f4 100644 --- a/core/src/main/java/ch/cyberduck/core/Profile.java +++ b/core/src/main/java/ch/cyberduck/core/Profile.java @@ -50,6 +50,9 @@ public class Profile implements Protocol { */ private final Protocol parent; + public static final String OAUTH_CLIENT_ID_KEY = "OAuth Client ID"; + public static final String OAUTH_CLIENT_SECRET_KEY = "OAuth Client Secret"; + private Local disk; private Local icon; @@ -512,7 +515,7 @@ public String getOAuthRedirectUrl() { @Override public String getOAuthClientId() { - final String v = this.value("OAuth Client ID"); + final String v = this.value(OAUTH_CLIENT_ID_KEY); if(StringUtils.isBlank(v)) { return parent.getOAuthClientId(); } @@ -521,7 +524,7 @@ public String getOAuthClientId() { @Override public String getOAuthClientSecret() { - final String v = this.value("OAuth Client Secret"); + final String v = this.value(OAUTH_CLIENT_SECRET_KEY); if(StringUtils.isBlank(v)) { return parent.getOAuthClientSecret(); } diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java index 44ef137e4cb..48995439a23 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java @@ -156,7 +156,7 @@ public void process(final HttpRequest request, final HttpContext context) { } } } - }).build(), host) { + }).build(), host, prompt) { @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { if(request instanceof HttpRequestWrapper) { diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java index 5f658db3e2c..78283cb4c52 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java @@ -27,6 +27,8 @@ import ch.cyberduck.core.UrlProvider; import ch.cyberduck.core.UseragentProvider; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.DefaultHttpRateLimiter; import ch.cyberduck.core.http.HttpSession; @@ -72,9 +74,9 @@ public DropboxSession(final Host host, final X509TrustManager trust, final X509K } @Override - protected CustomDbxRawClientV2 connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt, final CancelCallback cancel) { + protected CustomDbxRawClientV2 connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); - authorizationService = new OAuth2RequestInterceptor(configuration.build(), host) + authorizationService = new OAuth2RequestInterceptor(configuration.build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueSession.java b/eue/src/main/java/ch/cyberduck/core/eue/EueSession.java index 0d0a51e058a..84ebd0ae09b 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueSession.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueSession.java @@ -107,7 +107,7 @@ public void process(final HttpRequest request, final HttpContext context) { request.addHeader(HttpHeaders.AUTHORIZATION, String.format("Basic %s", Base64.encodeToString(String.format("%s:%s", host.getProtocol().getOAuthClientId(), host.getProtocol().getOAuthClientSecret()).getBytes(StandardCharsets.UTF_8), false))); } - }).build(), host) + }).build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl() ); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java index 922b2241819..ad6e5750233 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java @@ -25,7 +25,9 @@ import ch.cyberduck.core.UrlProvider; import ch.cyberduck.core.UseragentProvider; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; import ch.cyberduck.core.exception.HostParserException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.DefaultHttpRateLimiter; import ch.cyberduck.core.http.HttpSession; @@ -68,9 +70,9 @@ public DriveSession(final Host host, final X509TrustManager trust, final X509Key } @Override - protected Drive connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt, final CancelCallback cancel) throws HostParserException { + protected Drive connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt, final CancelCallback cancel) throws HostParserException, ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); - authorizationService = new OAuth2RequestInterceptor(builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host) + authorizationService = new OAuth2RequestInterceptor(builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStorageSession.java b/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStorageSession.java index ae3d57b831a..d6c0744eca4 100644 --- a/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStorageSession.java +++ b/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStorageSession.java @@ -25,6 +25,8 @@ import ch.cyberduck.core.UseragentProvider; import ch.cyberduck.core.cdn.DistributionConfiguration; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.HttpSession; import ch.cyberduck.core.http.UserAgentHttpRequestInitializer; @@ -63,9 +65,9 @@ public GoogleStorageSession(final Host host, final X509TrustManager trust, final } @Override - protected Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) { + protected Storage connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); - authorizationService = new OAuth2RequestInterceptor(builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host) + authorizationService = new OAuth2RequestInterceptor(builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/hubic/src/main/java/ch/cyberduck/core/hubic/HubicSession.java b/hubic/src/main/java/ch/cyberduck/core/hubic/HubicSession.java index 116525ee39d..175bd2ab95b 100644 --- a/hubic/src/main/java/ch/cyberduck/core/hubic/HubicSession.java +++ b/hubic/src/main/java/ch/cyberduck/core/hubic/HubicSession.java @@ -22,6 +22,8 @@ import ch.cyberduck.core.OAuthTokens; import ch.cyberduck.core.cdn.DistributionConfiguration; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor; import ch.cyberduck.core.oauth.OAuth2RequestInterceptor; import ch.cyberduck.core.openstack.SwiftExceptionMappingService; @@ -50,9 +52,9 @@ public HubicSession(final Host host, final X509TrustManager trust, final X509Key } @Override - protected Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) { + protected Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); - authorizationService = new OAuth2RequestInterceptor(configuration.build(), host) + authorizationService = new OAuth2RequestInterceptor(configuration.build(), host, prompt) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt)); diff --git a/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java b/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java index 25eae92e0be..1e4735e19af 100644 --- a/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java +++ b/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java @@ -24,6 +24,7 @@ import ch.cyberduck.core.LoginOptions; import ch.cyberduck.core.OAuthTokens; import ch.cyberduck.core.PreferencesUseragentProvider; +import ch.cyberduck.core.Profile; import ch.cyberduck.core.StringAppender; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.exception.InteroperabilityException; @@ -91,21 +92,23 @@ public class OAuth2AuthorizationService { private final HttpTransport transport; - public OAuth2AuthorizationService(final HttpClient client, + public OAuth2AuthorizationService(final HttpClient client, final Host host, final String tokenServerUrl, final String authorizationServerUrl, - final String clientid, final String clientsecret, final List scopes, final boolean pkce) { - this(new ApacheHttpTransport(client), - tokenServerUrl, authorizationServerUrl, clientid, clientsecret, scopes, pkce); + final String clientid, final String clientsecret, final List scopes, final boolean pkce, final LoginCallback prompt) throws LoginCanceledException { + this(new ApacheHttpTransport(client), host, + tokenServerUrl, authorizationServerUrl, clientid, clientsecret, scopes, pkce, prompt); } - public OAuth2AuthorizationService(final HttpTransport transport, + public OAuth2AuthorizationService(final HttpTransport transport, final Host host, final String tokenServerUrl, final String authorizationServerUrl, - final String clientid, final String clientsecret, final List scopes, final boolean pkce) { + final String clientid, final String clientsecret, final List scopes, final boolean pkce, final LoginCallback prompt) throws LoginCanceledException { this.transport = transport; this.tokenServerUrl = tokenServerUrl; this.authorizationServerUrl = authorizationServerUrl; - this.clientid = clientid; - this.clientsecret = clientsecret; + this.clientid = prompt(host, prompt, Profile.OAUTH_CLIENT_ID_KEY, LocaleFactory.localizedString( + Profile.OAUTH_CLIENT_ID_KEY, "Credentials"), clientid); + this.clientsecret = prompt(host, prompt, Profile.OAUTH_CLIENT_SECRET_KEY, LocaleFactory.localizedString( + Profile.OAUTH_CLIENT_SECRET_KEY, "Credentials"), clientsecret); this.scopes = scopes; this.pkce = pkce; } @@ -173,11 +176,11 @@ private TokenResponse authorizeWithCode(final Host bookmark, final LoginCallback } else { final Credentials clientid = prompt.prompt(bookmark, - LocaleFactory.localizedString("OAuth Client ID", "Credentials"), + LocaleFactory.localizedString(Profile.OAUTH_CLIENT_ID_KEY, "Credentials"), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), new LoginOptions(bookmark.getProtocol()) .user(true).password(true) - .passwordPlaceholder("OAuth Client ID")); + .passwordPlaceholder(LocaleFactory.localizedString(Profile.OAUTH_CLIENT_ID_KEY, "Credentials"))); if(clientid.isSaved()) { bookmark.setProperty("oauth.clientid", clientid.getPassword()); } @@ -377,4 +380,20 @@ public TokenResponse toTokenResponse() { } } + /** + * Prompt for value if missing + */ + private static String prompt(final Host bookmark, final LoginCallback prompt, + final String property, final String message, final String value) throws LoginCanceledException { + if(null == value) { + final Credentials input = prompt.prompt(bookmark, message, + LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), + new LoginOptions().icon(bookmark.getProtocol().disk())); + if(input.isSaved()) { + bookmark.setProperty(property, input.getPassword()); + } + return input.getPassword(); + } + return value; + } } diff --git a/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2RequestInterceptor.java b/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2RequestInterceptor.java index 691d6d47495..2c31ac47d66 100644 --- a/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2RequestInterceptor.java +++ b/oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2RequestInterceptor.java @@ -25,6 +25,7 @@ import ch.cyberduck.core.Scheme; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.exception.LocalAccessDeniedException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.threading.CancelCallback; import org.apache.commons.lang3.StringUtils; @@ -54,7 +55,7 @@ public class OAuth2RequestInterceptor extends OAuth2AuthorizationService impleme private final HostPasswordStore store = PasswordStoreFactory.get(); private final Host host; - public OAuth2RequestInterceptor(final HttpClient client, final Host host) { + public OAuth2RequestInterceptor(final HttpClient client, final Host host, final LoginCallback prompt) throws LoginCanceledException { this(client, host, Scheme.isURL(host.getProtocol().getOAuthTokenUrl()) ? host.getProtocol().getOAuthTokenUrl() : new HostUrlProvider().withUsername(false).withPath(true).get( host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getOAuthTokenUrl()), @@ -63,12 +64,12 @@ public OAuth2RequestInterceptor(final HttpClient client, final Host host) { host.getProtocol().getOAuthClientId(), host.getProtocol().getOAuthClientSecret(), host.getProtocol().getOAuthScopes(), - host.getProtocol().isOAuthPKCE()); + host.getProtocol().isOAuthPKCE(), prompt); } public OAuth2RequestInterceptor(final HttpClient client, final Host host, final String tokenServerUrl, final String authorizationServerUrl, - final String clientid, final String clientsecret, final List scopes, final boolean pkce) { - super(client, tokenServerUrl, authorizationServerUrl, clientid, clientsecret, scopes, pkce); + final String clientid, final String clientsecret, final List scopes, final boolean pkce, final LoginCallback prompt) throws LoginCanceledException { + super(client, host, tokenServerUrl, authorizationServerUrl, clientid, clientsecret, scopes, pkce, prompt); this.host = host; } diff --git a/onedrive/src/main/java/ch/cyberduck/core/onedrive/GraphSession.java b/onedrive/src/main/java/ch/cyberduck/core/onedrive/GraphSession.java index 88e01281abd..ba3d542b3bf 100644 --- a/onedrive/src/main/java/ch/cyberduck/core/onedrive/GraphSession.java +++ b/onedrive/src/main/java/ch/cyberduck/core/onedrive/GraphSession.java @@ -24,7 +24,9 @@ import ch.cyberduck.core.SimplePathPredicate; import ch.cyberduck.core.UrlProvider; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; import ch.cyberduck.core.exception.HostParserException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.HttpSession; import ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor; @@ -125,10 +127,10 @@ public User.Metadata getUser() { } @Override - protected OneDriveAPI connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws HostParserException { + protected OneDriveAPI connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws HostParserException, ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); authorizationService = new OAuth2RequestInterceptor( - builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host) { + builder.build(ProxyFactory.get().find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host, prompt) { @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { if(request.containsHeader(HttpHeaders.AUTHORIZATION)) { diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSession.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSession.java index b9dbd0cd4c3..254262b02fb 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSession.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSession.java @@ -30,7 +30,9 @@ import ch.cyberduck.core.cdn.DistributionConfiguration; import ch.cyberduck.core.exception.AccessDeniedException; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; import ch.cyberduck.core.exception.InteroperabilityException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.exception.LoginFailureException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.HttpSession; @@ -71,7 +73,7 @@ public SwiftSession(final Host host, final X509TrustManager trust, final X509Key } @Override - protected Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) { + protected Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { // Always inject new pool to builder on connect because the pool is shutdown on disconnect final HttpClientBuilder pool = builder.build(proxy, this, prompt); pool.disableContentCompression(); diff --git a/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java b/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java index ba976addb08..93515f26030 100644 --- a/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java +++ b/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java @@ -21,6 +21,8 @@ import ch.cyberduck.core.UrlProvider; import ch.cyberduck.core.dav.DAVSession; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.AttributesFinder; import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.features.Home; @@ -60,10 +62,10 @@ public OwncloudSession(final Host host, final X509TrustManager trust, final X509 } @Override - protected HttpClientBuilder getConfiguration(final Proxy proxy, final LoginCallback prompt) { + protected HttpClientBuilder getConfiguration(final Proxy proxy, final LoginCallback prompt) throws ConnectionCanceledException { final HttpClientBuilder configuration = super.getConfiguration(proxy, prompt); if(host.getProtocol().isOAuthConfigurable()) { - authorizationService = new OAuth2RequestInterceptor(configuration.build(), host) + authorizationService = new OAuth2RequestInterceptor(configuration.build(), host, prompt) .withFlowType(OAuth2AuthorizationService.FlowType.valueOf(host.getProtocol().getAuthorization())) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); configuration.addInterceptorLast(authorizationService); diff --git a/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateSession.java b/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateSession.java index 25661760222..c98c7600200 100644 --- a/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateSession.java +++ b/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateSession.java @@ -27,6 +27,8 @@ import ch.cyberduck.core.PreferencesUseragentProvider; import ch.cyberduck.core.Scheme; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ConnectionCanceledException; +import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.exception.LoginFailureException; import ch.cyberduck.core.features.*; import ch.cyberduck.core.http.HttpSession; @@ -95,7 +97,7 @@ public StoregateSession(final Host host, final X509TrustManager trust, final X50 } @Override - protected StoregateApiClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) { + protected StoregateApiClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); final PreferencesReader preferences = new HostPreferences(host); authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).addInterceptorLast(new HttpRequestInterceptor() { @@ -104,7 +106,7 @@ public void process(final HttpRequest request, final HttpContext context) { request.addHeader(HttpHeaders.AUTHORIZATION, String.format("Basic %s", Base64.encodeToString(String.format("%s:%s", host.getProtocol().getOAuthClientId(), host.getProtocol().getOAuthClientSecret()).getBytes(StandardCharsets.UTF_8), false))); } - }).build(), host) + }).build(), host, prompt) .withRedirectUri(CYBERDUCK_REDIRECT_URI.equals(host.getProtocol().getOAuthRedirectUrl()) ? host.getProtocol().getOAuthRedirectUrl() : 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()) diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java index ace5c3a9d28..598ba59d8e6 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java @@ -109,7 +109,7 @@ protected DAVClient connect(final Proxy proxy, final HostKeyCallback key, final return new DAVClient(new HostUrlProvider().withUsername(false).get(host), configuration); } - protected HttpClientBuilder getConfiguration(final Proxy proxy, final LoginCallback prompt) { + protected HttpClientBuilder getConfiguration(final Proxy proxy, final LoginCallback prompt) throws ConnectionCanceledException { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.setRedirectStrategy(new DAVRedirectStrategy(redirect)); return configuration;