mirror of
https://github.com/iterate-ch/cyberduck.git
synced 2026-05-26 19:10:49 +00:00
Allow failure when reloading credentials configuration.
This commit is contained in:
@@ -19,6 +19,7 @@ import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.Credentials;
|
||||
import ch.cyberduck.core.CredentialsConfigurator;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -41,7 +42,7 @@ public class BrickCredentialsConfigurator implements CredentialsConfigurator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialsConfigurator reload() {
|
||||
public CredentialsConfigurator reload() throws LoginCanceledException {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package ch.cyberduck.core;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
public interface CredentialsConfigurator {
|
||||
|
||||
/**
|
||||
@@ -27,7 +29,7 @@ public interface CredentialsConfigurator {
|
||||
*/
|
||||
Credentials configure(Host host);
|
||||
|
||||
CredentialsConfigurator reload();
|
||||
CredentialsConfigurator reload() throws LoginCanceledException;
|
||||
|
||||
CredentialsConfigurator DISABLED = new CredentialsConfigurator() {
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package ch.cyberduck.core;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
public final class CredentialsConfiguratorFactory {
|
||||
|
||||
private CredentialsConfiguratorFactory() {
|
||||
@@ -29,6 +31,11 @@ public final class CredentialsConfiguratorFactory {
|
||||
* @return Configurator for default settings
|
||||
*/
|
||||
public static CredentialsConfigurator get(final Protocol protocol) {
|
||||
return protocol.getCredentialsFinder().reload();
|
||||
try {
|
||||
return protocol.getCredentialsFinder().reload();
|
||||
}
|
||||
catch(LoginCanceledException e) {
|
||||
return CredentialsConfigurator.DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package ch.cyberduck.core;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
public final class JumpHostConfiguratorFactory {
|
||||
|
||||
private JumpHostConfiguratorFactory() {
|
||||
@@ -29,6 +31,11 @@ public final class JumpHostConfiguratorFactory {
|
||||
* @return Configurator for default settings
|
||||
*/
|
||||
public static JumphostConfigurator get(final Protocol protocol) {
|
||||
return protocol.getJumpHostFinder().reload();
|
||||
try {
|
||||
return protocol.getJumpHostFinder().reload();
|
||||
}
|
||||
catch(LoginCanceledException e) {
|
||||
return JumphostConfigurator.DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,13 @@ package ch.cyberduck.core;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
public interface JumphostConfigurator {
|
||||
|
||||
Host getJumphost(String alias);
|
||||
|
||||
JumphostConfigurator reload();
|
||||
JumphostConfigurator reload() throws LoginCanceledException;
|
||||
|
||||
JumphostConfigurator DISABLED = new JumphostConfigurator() {
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
import ch.cyberduck.core.preferences.HostPreferences;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -51,7 +52,7 @@ public class WindowsIntegratedCredentialsConfigurator implements CredentialsConf
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialsConfigurator reload() {
|
||||
public CredentialsConfigurator reload() throws LoginCanceledException {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import ch.cyberduck.core.Credentials;
|
||||
import ch.cyberduck.core.CredentialsConfigurator;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.LoginOptions;
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -66,7 +67,7 @@ public class AWSCredentialsConfigurator implements CredentialsConfigurator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialsConfigurator reload() {
|
||||
public CredentialsConfigurator reload() throws LoginCanceledException {
|
||||
for(AWSCredentialsProvider provider : providers) {
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import ch.cyberduck.core.dav.DAVReadFeature;
|
||||
import ch.cyberduck.core.dav.DAVSession;
|
||||
import ch.cyberduck.core.exception.BackgroundException;
|
||||
import ch.cyberduck.core.exception.InteroperabilityException;
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
import ch.cyberduck.core.proxy.ProxyFactory;
|
||||
import ch.cyberduck.core.ssl.X509KeyManager;
|
||||
import ch.cyberduck.core.ssl.X509TrustManager;
|
||||
@@ -82,7 +83,7 @@ public class AWSSessionCredentialsRetriever {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configurator reload() {
|
||||
public Configurator reload() throws LoginCanceledException {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ public class AWSProfileSTSCredentialsConfigurator implements CredentialsConfigur
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialsConfigurator reload() {
|
||||
public CredentialsConfigurator reload() throws LoginCanceledException {
|
||||
// See https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html for configuration behavior
|
||||
final Local configFile = LocalFactory.get(directory, "config");
|
||||
final Local credentialsFile = LocalFactory.get(directory, "credentials");
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.Local;
|
||||
import ch.cyberduck.core.LocalFactory;
|
||||
import ch.cyberduck.core.LoginOptions;
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
import ch.cyberduck.core.preferences.HostPreferences;
|
||||
import ch.cyberduck.core.sftp.openssh.config.transport.OpenSshConfig;
|
||||
|
||||
@@ -91,7 +92,7 @@ public class OpenSSHCredentialsConfigurator implements CredentialsConfigurator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialsConfigurator reload() {
|
||||
public CredentialsConfigurator reload() throws LoginCanceledException {
|
||||
configuration.refresh();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import ch.cyberduck.core.JumphostConfigurator;
|
||||
import ch.cyberduck.core.LocalFactory;
|
||||
import ch.cyberduck.core.ProtocolFactory;
|
||||
import ch.cyberduck.core.exception.HostParserException;
|
||||
import ch.cyberduck.core.exception.LoginCanceledException;
|
||||
import ch.cyberduck.core.sftp.SFTPProtocol;
|
||||
import ch.cyberduck.core.sftp.openssh.config.transport.OpenSshConfig;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class OpenSSHJumpHostConfigurator implements JumphostConfigurator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JumphostConfigurator reload() {
|
||||
public JumphostConfigurator reload() throws LoginCanceledException {
|
||||
hostname.reload();
|
||||
credentials.reload();
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user