use of ch.cyberduck.core.LoginConnectionService 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());
}
use of ch.cyberduck.core.LoginConnectionService 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());
}
use of ch.cyberduck.core.LoginConnectionService in project cyberduck by iterate-ch.
the class AbstractS3DirectSDSTest method setup.
@Before
public void setup() throws Exception {
session = new SDSSession(new Host(new SDSProtocol(), "duck.dracoon.com", new Credentials(System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))), new DisabledX509TrustManager(), new DefaultX509KeyManager());
session.enableMetrics();
final LoginConnectionService connect = new LoginConnectionService(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
throw new LoginCanceledException();
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
connect.check(session, new DisabledCancelCallback());
}
use of ch.cyberduck.core.LoginConnectionService in project cyberduck by iterate-ch.
the class AbstractSDSTest method setup.
@Before
public void setup() throws Exception {
session = new SDSSession(new Host(new SDSProtocol(), "duck.dracoon.com", new Credentials(System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))), new DisabledX509TrustManager(), new DefaultX509KeyManager());
session.enableMetrics();
final LoginConnectionService connect = new LoginConnectionService(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
throw new LoginCanceledException();
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
connect.check(session, new DisabledCancelCallback());
}
use of ch.cyberduck.core.LoginConnectionService in project cyberduck by iterate-ch.
the class GoogleStorageSessionTest method testConnectInvalidAccessTokenRefreshToken.
@Test
public void testConnectInvalidAccessTokenRefreshToken() throws Exception {
session.close();
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback(), 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")) {
// Mark as not expired
PreferencesFactory.get().setProperty("googlestorage.oauth.expiry", System.currentTimeMillis() + 60 * 1000);
return "a";
}
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());
}
Aggregations