use of ch.cyberduck.core.Credentials in project cyberduck by iterate-ch.
the class FTPProtocolTest method testValidateCredentialsEmpty.
@Test
public void testValidateCredentialsEmpty() {
Credentials c = new Credentials("user", "");
assertTrue(c.validate(new FTPProtocol(), new LoginOptions(new FTPProtocol())));
}
use of ch.cyberduck.core.Credentials in project cyberduck by iterate-ch.
the class FTPProtocolTest method testValidateCredentialsBlank.
@Test
public void testValidateCredentialsBlank() {
Credentials c = new Credentials("user", " ");
assertTrue(c.validate(new FTPProtocol(), new LoginOptions(new FTPProtocol())));
}
use of ch.cyberduck.core.Credentials in project cyberduck by iterate-ch.
the class StatefulDefaultCopyFeatureTest method testSupported.
@Test
public void testSupported() throws Exception {
final Path source = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
final Path target = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
assertFalse(new DefaultCopyFeature(session).isSupported(source, target));
assertFalse(new DefaultCopyFeature(session).withTarget(session).isSupported(source, target));
assertTrue(new DefaultCopyFeature(session).withTarget(new FTPSession(new Host(session.getHost()).withCredentials(new Credentials("test", "test")))).isSupported(source, target));
}
use of ch.cyberduck.core.Credentials in project cyberduck by iterate-ch.
the class AbstractGoogleStorageTest method setup.
@Before
public void setup() throws Exception {
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new GoogleStorageProtocol())));
final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Google Cloud Storage.cyberduckprofile"));
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(System.getProperties().getProperty("google.projectid"), null));
session = new GoogleStorageSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) {
fail(reason);
return null;
}
}, 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, new DisabledCancelCallback());
}
use of ch.cyberduck.core.Credentials in project cyberduck by iterate-ch.
the class MantaProtocolTest method testValidateCredentials.
@Test
public void testValidateCredentials() throws Exception {
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new MantaProtocol())));
final Profile profile = new ProfilePlistReader(factory).read(new Local("../profiles/Joyent Triton Object Storage (us-east).cyberduckprofile"));
assertFalse(profile.validate(new Credentials(), new LoginOptions(profile)));
assertFalse(profile.validate(new Credentials("u@domain"), new LoginOptions(profile)));
assertFalse(profile.validate(new Credentials("u@domain", "p"), new LoginOptions(profile)));
assertFalse(profile.validate(new Credentials("u@domain").withIdentity(new NullLocal("/f") {
@Override
public boolean exists() {
return false;
}
}), new LoginOptions(profile)));
assertTrue(profile.validate(new Credentials("u@domain").withIdentity(new NullLocal("/f") {
@Override
public boolean exists() {
return true;
}
}), new LoginOptions(profile)));
}
Aggregations