Search in sources :

Example 21 with Credentials

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())));
}
Also used : LoginOptions(ch.cyberduck.core.LoginOptions) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test)

Example 22 with Credentials

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())));
}
Also used : LoginOptions(ch.cyberduck.core.LoginOptions) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test)

Example 23 with Credentials

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));
}
Also used : Path(ch.cyberduck.core.Path) FTPSession(ch.cyberduck.core.ftp.FTPSession) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) Host(ch.cyberduck.core.Host) Credentials(ch.cyberduck.core.Credentials) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 24 with Credentials

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());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Scheme(ch.cyberduck.core.Scheme) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 25 with Credentials

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)));
}
Also used : ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) NullLocal(ch.cyberduck.core.NullLocal) NullLocal(ch.cyberduck.core.NullLocal) Local(ch.cyberduck.core.Local) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test)

Aggregations

Credentials (ch.cyberduck.core.Credentials)252 Host (ch.cyberduck.core.Host)201 Test (org.junit.Test)189 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)165 IntegrationTest (ch.cyberduck.test.IntegrationTest)156 Path (ch.cyberduck.core.Path)138 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)137 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)134 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)103 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)95 LoginOptions (ch.cyberduck.core.LoginOptions)92 DisabledX509TrustManager (ch.cyberduck.core.ssl.DisabledX509TrustManager)84 Delete (ch.cyberduck.core.features.Delete)76 Local (ch.cyberduck.core.Local)60 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)56 ProtocolFactory (ch.cyberduck.core.ProtocolFactory)55 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)55 Scheme (ch.cyberduck.core.Scheme)52 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)51 Profile (ch.cyberduck.core.Profile)50