Search in sources :

Example 1 with DefaultX509TrustManager

use of ch.cyberduck.core.ssl.DefaultX509TrustManager in project cyberduck by iterate-ch.

the class AbstractBrickTest method setup.

@Before
public void setup() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new BrickProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Brick.cyberduckprofile"));
    final Host host = new Host(profile, "mountainduck.files.com", new Credentials(System.getProperties().getProperty("brick.user"), System.getProperties().getProperty("brick.password")));
    session = new BrickSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
            fail(reason);
            return null;
        }
    }, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
    login.check(session, new DisabledCancelCallback());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) 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 2 with DefaultX509TrustManager

use of ch.cyberduck.core.ssl.DefaultX509TrustManager in project cyberduck by iterate-ch.

the class AbtractBoxTest method setup.

@Before
public void setup() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new BoxProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Box.cyberduckprofile"));
    final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials("cyberduck"));
    session = new BoxSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
            fail(reason);
            return null;
        }
    }, new DisabledHostKeyCallback(), new TestPasswordStore(), new DisabledProgressListener());
    login.check(session, new DisabledCancelCallback());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) 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) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 3 with DefaultX509TrustManager

use of ch.cyberduck.core.ssl.DefaultX509TrustManager 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 4 with DefaultX509TrustManager

use of ch.cyberduck.core.ssl.DefaultX509TrustManager in project cyberduck by iterate-ch.

the class OneDriveBusinessContextLoginTest method testLogin.

@Test(expected = LoginCanceledException.class)
public void testLogin() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new OneDriveProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Microsoft SharePoint.cyberduckprofile"));
    final Host host = new Host(profile, profile.getDefaultHostname());
    final OneDriveSession session = new OneDriveSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
            assertEquals("OAuth2 Authentication", title);
            throw new LoginCanceledException();
        }
    }, new DisabledHostKeyCallback(), new DisabledPasswordStore() {

        @Override
        public String getPassword(Scheme scheme, int port, String hostname, String user) {
            if ("Microsoft OneDrive Business OAuth2 Access Token".equals(user)) {
                return System.getProperties().getProperty("onedrive.business.accesstoken");
            }
            if ("Microsoft OneDrive Business OAuth2 Refresh Token".equals(user)) {
                return System.getProperties().getProperty("onedrive.business.refreshtoken");
            }
            return null;
        }

        @Override
        public String getPassword(String hostname, String user) {
            return super.getPassword(hostname, user);
        }
    }, new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
    assertEquals("/b!9prv2DvXt0Cua27a0kKBHlYP69u02QdCtkueQRimv8UsYPDHr-_uQoMvBiuYAjdH", (new OneDriveHomeFinderService().find().getAbsolute()));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Scheme(ch.cyberduck.core.Scheme) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) LoginCanceledException(ch.cyberduck.core.exception.LoginCanceledException) 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) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 5 with DefaultX509TrustManager

use of ch.cyberduck.core.ssl.DefaultX509TrustManager in project cyberduck by iterate-ch.

the class CustomOriginCloudFrontDistributionConfigurationTest method testReadMissingCredentials.

@Test(expected = LoginCanceledException.class)
public void testReadMissingCredentials() throws Exception {
    final Host bookmark = new Host(new TestProtocol(), "myhost.localdomain");
    final CustomOriginCloudFrontDistributionConfiguration configuration = new CustomOriginCloudFrontDistributionConfiguration(bookmark, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    configuration.read(container, Distribution.CUSTOM, new DisabledLoginCallback());
}
Also used : Path(ch.cyberduck.core.Path) TestProtocol(ch.cyberduck.core.TestProtocol) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) Host(ch.cyberduck.core.Host) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

DefaultX509TrustManager (ch.cyberduck.core.ssl.DefaultX509TrustManager)38 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)29 Host (ch.cyberduck.core.Host)25 Test (org.junit.Test)23 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)22 IntegrationTest (ch.cyberduck.test.IntegrationTest)22 Credentials (ch.cyberduck.core.Credentials)19 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)19 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)19 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)18 LoginOptions (ch.cyberduck.core.LoginOptions)17 Profile (ch.cyberduck.core.Profile)17 ProtocolFactory (ch.cyberduck.core.ProtocolFactory)17 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)16 LoginConnectionService (ch.cyberduck.core.LoginConnectionService)15 Before (org.junit.Before)15 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)9 KeychainX509KeyManager (ch.cyberduck.core.ssl.KeychainX509KeyManager)9 Ignore (org.junit.Ignore)8 Path (ch.cyberduck.core.Path)7