Add test password store implementation.

This commit is contained in:
David Kocher
2026-02-10 11:38:50 +01:00
parent 1faf8fc70a
commit a5212138ec
29 changed files with 127 additions and 606 deletions
@@ -17,7 +17,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -48,10 +47,10 @@ public class AbstractAzureTest extends VaultTest {
@Before
public void setup() throws Exception {
final Host host = new Host(new AzureProtocol(), "kahy9boj3eib.blob.core.windows.net", new Credentials(
PROPERTIES.get("azure.user"), PROPERTIES.get("azure.password")
PROPERTIES.get("azure.user")
));
session = new AzureSession(host);
new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
new TestPasswordStore(), new DisabledProgressListener()).check(session, new DisabledCancelCallback());
}
}
@@ -4,8 +4,6 @@ import ch.cyberduck.core.AlphanumericRandomStringService;
import ch.cyberduck.core.DescriptiveUrl;
import ch.cyberduck.core.DescriptiveUrlBag;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.features.Delete;
import ch.cyberduck.core.transfer.TransferStatus;
@@ -28,12 +26,7 @@ public class AzureUrlProviderTest extends AbstractAzureTest {
final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new AzureTouchFeature(session).touch(new AzureWriteFeature(session), test, new TransferStatus());
final DescriptiveUrlBag urls = new AzureUrlProvider(session, new DisabledPasswordStore() {
@Override
public String findLoginPassword(final Host bookmark) {
return PROPERTIES.get("azure.password");
}
}).toUrl(test).filter(DescriptiveUrl.Type.signed);
final DescriptiveUrlBag urls = new AzureUrlProvider(session, new TestPasswordStore()).toUrl(test).filter(DescriptiveUrl.Type.signed);
assertEquals(5, urls.size());
for(DescriptiveUrl url : urls) {
assertFalse(url.getUrl().isEmpty());
@@ -19,7 +19,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -65,9 +64,7 @@ public class AbstractB2Test extends VaultTest {
this.getClass().getResourceAsStream("/B2.cyberduckprofile"));
session = new B2Session(
new Host(profile, profile.getDefaultHostname(),
new Credentials(
PROPERTIES.get("b2.user"), PROPERTIES.get("b2.password")
)), new DefaultX509TrustManager(), new DefaultX509KeyManager());
new Credentials(PROPERTIES.get("b2.user"))), 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) {
@@ -75,7 +72,7 @@ public class AbstractB2Test extends VaultTest {
return null;
}
}, new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener());
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
}
@@ -15,7 +15,20 @@ package ch.cyberduck.core.worker;
* GNU General Public License for more details.
*/
import ch.cyberduck.core.*;
import ch.cyberduck.core.BytecountStreamListener;
import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledConnectionCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordCallback;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.DisabledTranscriptListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Session;
import ch.cyberduck.core.b2.AbstractB2Test;
import ch.cyberduck.core.b2.B2AttributesFinderFeature;
import ch.cyberduck.core.b2.B2DeleteFeature;
@@ -99,7 +112,7 @@ public class B2ConcurrentTransferWorkerTest extends AbstractB2Test {
};
final LoginConnectionService connect = new LoginConnectionService(new DisabledLoginCallback(),
new DisabledHostKeyCallback(),
new DisabledPasswordStore(),
new TestPasswordStore(),
new DisabledProgressListener());
final DefaultSessionPool pool = new DefaultSessionPool(connect,
new DefaultVaultRegistry(new DisabledPasswordCallback()), new DisabledTranscriptListener(), host,
@@ -108,7 +121,7 @@ public class B2ConcurrentTransferWorkerTest extends AbstractB2Test {
@Override
public Session create() {
return new B2Session(host.setCredentials(new Credentials(
PROPERTIES.get("b2.user"), PROPERTIES.get("b2.password")
PROPERTIES.get("b2.user")
)), new DefaultX509TrustManager(), new DefaultX509KeyManager()) {
final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this)
) {
@@ -20,7 +20,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
@@ -105,7 +104,7 @@ public class B2SingleTransferWorkerTest extends VaultTest {
}
};
final B2Session session = new B2Session(host.setCredentials(new Credentials(
PROPERTIES.get("b2.user"), PROPERTIES.get("b2.password")
PROPERTIES.get("b2.user")
)), new DefaultX509TrustManager(), new DefaultX509KeyManager()) {
final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this)
) {
@@ -139,8 +138,8 @@ public class B2SingleTransferWorkerTest extends VaultTest {
};
new LoginConnectionService(new DisabledLoginCallback(),
new DisabledHostKeyCallback(),
new DisabledPasswordStore(),
new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
new TestPasswordStore(),
new DisabledProgressListener()).check(session, new DisabledCancelCallback());
final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
final Path test = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
final Transfer t = new UploadTransfer(host, test, local);
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.cryptomator.CryptoVault;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -76,42 +74,4 @@ public class AbstractBoxTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Box (post@iterate.ch) OAuth2 Token Expiry")) {
return PROPERTIES.get("box.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("Box (post@iterate.ch) OAuth2 Access Token")) {
return PROPERTIES.get("box.accesstoken");
}
if(user.equals("Box (post@iterate.ch) OAuth2 Refresh Token")) {
return PROPERTIES.get("box.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Box (post@iterate.ch) OAuth2 Token Expiry")) {
VaultTest.add("box.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Box (post@iterate.ch) OAuth2 Access Token")) {
VaultTest.add("box.accesstoken", password);
}
if(user.equals("Box (post@iterate.ch) OAuth2 Refresh Token")) {
VaultTest.add("box.refreshtoken", password);
}
}
}
}
@@ -19,7 +19,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -64,7 +63,7 @@ public class AbstractBrickTest extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/Brick.cyberduckprofile"));
final Host host = new Host(profile, "mountainduck.files.com", new Credentials(
PROPERTIES.get("brick.user"), PROPERTIES.get("brick.password")
PROPERTIES.get("brick.user")
));
session = new BrickSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@@ -73,7 +72,7 @@ public class AbstractBrickTest extends VaultTest {
fail(reason);
return null;
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
}, new DisabledHostKeyCallback(), new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
}
@@ -15,6 +15,14 @@ package ch.cyberduck.test;
* GNU General Public License for more details.
*/
import ch.cyberduck.core.DefaultHostPasswordStore;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.HostUrlProvider;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.exception.AccessDeniedException;
import ch.cyberduck.core.preferences.PreferencesFactory;
import org.apache.commons.lang3.StringUtils;
import org.junit.BeforeClass;
import java.util.HashMap;
@@ -34,7 +42,7 @@ public class VaultTest {
protected static Map<String, String> PROPERTIES;
@BeforeClass
public static void credentials() {
public static void vault() {
final VaultConfig config;
try {
config = new VaultConfig()
@@ -50,17 +58,69 @@ public class VaultTest {
PROPERTIES = VAULT.logical().read(VAULT_PATH).getData();
}
catch(VaultException e) {
throw new RuntimeException("Failed to initialize vault", e);
throw new RuntimeException(e);
}
}
public static void add(final String key, final String value) {
PROPERTIES.put(key, value);
try {
VAULT.logical().write(VAULT_PATH, new HashMap<>(PROPERTIES));
@BeforeClass
public static void register() {
PreferencesFactory.get().setDefault("factory.passwordstore.class", TestPasswordStore.class.getName());
}
public static class TestPasswordStore extends DefaultHostPasswordStore {
private final HostUrlProvider provider = new HostUrlProvider().withPath(false);
@Override
public void save(final Host bookmark) throws AccessDeniedException {
super.save(bookmark);
try {
VAULT.logical().write(VAULT_PATH, new HashMap<>(PROPERTIES));
}
catch(VaultException e) {
throw new AccessDeniedException(e.getMessage(), e);
}
}
catch(VaultException e) {
throw new RuntimeException("Failure adding key/value", e);
@Override
public void delete(final Host bookmark) throws AccessDeniedException {
super.delete(bookmark);
try {
VAULT.logical().write(VAULT_PATH, new HashMap<>(PROPERTIES));
}
catch(VaultException e) {
throw new AccessDeniedException(e.getMessage(), e);
}
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) throws AccessDeniedException {
PROPERTIES.put(String.format("%s/%s", serviceName, accountName), password);
}
@Override
public String getPassword(final String serviceName, final String accountName) throws AccessDeniedException {
return PROPERTIES.get(String.format("%s/%s", serviceName, accountName));
}
@Override
public void deletePassword(final String serviceName, final String user) {
PROPERTIES.remove(String.format("%s/%s", serviceName, user));
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) throws AccessDeniedException {
PROPERTIES.put(provider.get(scheme, port, user, hostname, StringUtils.EMPTY), password);
}
@Override
public String getPassword(final Scheme scheme, final int port, final String hostname, final String user) throws AccessDeniedException {
return PROPERTIES.get(provider.get(scheme, port, user, hostname, StringUtils.EMPTY));
}
@Override
public void deletePassword(final Scheme scheme, final int port, final String hostname, final String user) {
PROPERTIES.remove(provider.get(scheme, port, user, hostname, StringUtils.EMPTY));
}
}
}
@@ -19,7 +19,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -42,10 +41,7 @@ public class AbstractCteraDirectIOTest extends VaultTest {
@Before
public void setup() throws Exception {
final Host host = new Host(new CteraProtocol(), "dcdirect.ctera.me", new Credentials(
PROPERTIES.get("ctera.directio.user"), PROPERTIES.get("ctera.directio.password"),
PROPERTIES.get("ctera.directio.token")
)) {
final Host host = new Host(new CteraProtocol(), "dcdirect.ctera.me", new Credentials(PROPERTIES.get("ctera.directio.user"))) {
@Override
public String getProperty(final String key) {
if("ctera.download.directio.enable".equals(key)) {
@@ -60,27 +56,4 @@ public class AbstractCteraDirectIOTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener(), new DisabledProxyFinder());
connect.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("API Access Key (admin)")) {
return PROPERTIES.get("ctera.directio.accesskey");
}
if(accountName.equals("API Secret Key (admin)")) {
return PROPERTIES.get("ctera.directio.secretkey");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("API Access Key (admin)")) {
VaultTest.add("ctera.directio.accesskey", password);
}
if(accountName.equals("API Secret Key (admin)")) {
VaultTest.add("ctera.directio.secretkey", password);
}
}
}
}
@@ -19,8 +19,10 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.proxy.DisabledProxyFinder;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
import ch.cyberduck.core.ssl.DisabledX509TrustManager;
import ch.cyberduck.test.VaultTest;
@@ -28,8 +30,7 @@ import ch.cyberduck.test.VaultTest;
import org.junit.After;
import org.junit.Before;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class AbstractCteraTest extends VaultTest {
@@ -42,15 +43,16 @@ public class AbstractCteraTest extends VaultTest {
@Before
public void setup() throws Exception {
final Host host = new Host(new CteraProtocol(), "driveconnect.ctera.me", new Credentials(
PROPERTIES.get("ctera.user"), PROPERTIES.get("ctera.password"),
PROPERTIES.get("ctera.token")
));
final Host host = new Host(new CteraProtocol(), "driveconnect.ctera.me", new Credentials(PROPERTIES.get("ctera.user")));
host.setDefaultPath("/ServicesPortal/webdav/My Files");
session = new CteraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
assertNotNull(session.open(new DisabledProxyFinder(), new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback()));
assertTrue(session.isConnected());
assertNotNull(session.getClient());
session.login(new DisabledLoginCallback(), new DisabledCancelCallback());
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());
}
}
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -36,12 +34,8 @@ import ch.cyberduck.test.VaultTest;
import org.junit.After;
import org.junit.Before;
import java.util.AbstractMap;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.Assert.fail;
@@ -100,56 +94,4 @@ public class AbstractDeepboxTest extends VaultTest {
login.check(session, new DisabledCancelCallback());
return session;
}
public static class TestPasswordStore extends DisabledPasswordStore {
final Map<String, String> map = Stream.of(
new AbstractMap.SimpleImmutableEntry<>("deepbox-desktop-app-int (deepboxpeninna+deepboxapp1@gmail.com)", "deepbox.deepboxapp1"),
new AbstractMap.SimpleImmutableEntry<>("deepbox-desktop-app-int (deepboxpeninna+deepboxapp2@gmail.com)", "deepbox.deepboxapp2"),
new AbstractMap.SimpleImmutableEntry<>("deepbox-desktop-app-int (deepboxpeninna+deepboxapp3@gmail.com)", "deepbox.deepboxapp3"),
new AbstractMap.SimpleImmutableEntry<>("deepbox-desktop-app-int (deepboxpeninna+deepboxapp4@gmail.com)", "deepbox.deepboxapp4"),
new AbstractMap.SimpleImmutableEntry<>("deepbox-desktop-app-int (deepboxpeninna+deepboxappshare@gmail.com)", "deepbox.deepboxappshare"))
.collect(Collectors.toMap(AbstractMap.SimpleImmutableEntry::getKey, AbstractMap.SimpleImmutableEntry::getValue));
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.endsWith("OAuth2 Token Expiry")) {
final String prefix = accountName.replace(" OAuth2 Token Expiry", "");
return PROPERTIES.get(String.format("%s.tokenexpiry", map.get(prefix)));
}
return null;
}
@Override
public String getPassword(final Scheme scheme, final int port, final String hostname, final String user) {
if(user.endsWith("OAuth2 Access Token")) {
final String prefix = user.replace(" OAuth2 Access Token", "");
return PROPERTIES.get(String.format("%s.accesstoken", map.get(prefix)));
}
if(user.endsWith("OAuth2 Refresh Token")) {
final String prefix = user.replace(" OAuth2 Refresh Token", "");
return PROPERTIES.get(String.format("%s.refreshtoken", map.get(prefix)));
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.endsWith("OAuth2 Token Expiry")) {
final String prefix = accountName.replace(" OAuth2 Token Expiry", "");
VaultTest.add(String.format("%s.tokenexpiry", map.get(prefix)), password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.endsWith("OAuth2 Access Token")) {
final String prefix = user.replace(" OAuth2 Access Token", "");
VaultTest.add(String.format("%s.accesstoken", map.get(prefix)), password);
}
if(user.endsWith("OAuth2 Refresh Token")) {
final String prefix = user.replace(" OAuth2 Refresh Token", "");
VaultTest.add(String.format("%s.refreshtoken", map.get(prefix)), password);
}
}
}
}
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.exception.LoginCanceledException;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -65,42 +63,4 @@ public class AbstractSDSTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
connect.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Token Expiry")) {
return PROPERTIES.get("dracoon.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Access Token")) {
return PROPERTIES.get("dracoon.accesstoken");
}
if(user.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Refresh Token")) {
return PROPERTIES.get("dracoon.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Token Expiry")) {
VaultTest.add("dracoon.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Access Token")) {
VaultTest.add("dracoon.accesstoken", password);
}
if(user.equals("DRACOON (OAuth) (dkocher+test@iterate.ch) OAuth2 Refresh Token")) {
VaultTest.add("dracoon.refreshtoken", password);
}
}
}
}
@@ -66,42 +66,4 @@ public class AbstractDropboxTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Dropbox (cyberduck) OAuth2 Token Expiry")) {
return PROPERTIES.get("dropbox.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("Dropbox (cyberduck) OAuth2 Access Token")) {
return PROPERTIES.get("dropbox.accesstoken");
}
if(user.equals("Dropbox (cyberduck) OAuth2 Refresh Token")) {
return PROPERTIES.get("dropbox.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Dropbox (cyberduck) OAuth2 Token Expiry")) {
VaultTest.add("dropbox.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Dropbox (cyberduck) OAuth2 Access Token")) {
VaultTest.add("dropbox.accesstoken", password);
}
if(user.equals("Dropbox (cyberduck) OAuth2 Refresh Token")) {
VaultTest.add("dropbox.refreshtoken", password);
}
}
}
}
@@ -95,44 +95,6 @@ public class AbstractEueSessionTest extends VaultTest {
session.close();
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("GMX Cloud (1015156902205593160) OAuth2 Token Expiry")) {
return PROPERTIES.get("eue.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("GMX Cloud (1015156902205593160) OAuth2 Access Token")) {
return PROPERTIES.get("eue.accesstoken");
}
if(user.equals("GMX Cloud (1015156902205593160) OAuth2 Refresh Token")) {
return PROPERTIES.get("eue.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("GMX Cloud (1015156902205593160) OAuth2 Token Expiry")) {
VaultTest.add("eue.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("GMX Cloud (1015156902205593160) OAuth2 Access Token")) {
VaultTest.add("eue.accesstoken", password);
}
if(user.equals("GMX Cloud (1015156902205593160) OAuth2 Refresh Token")) {
VaultTest.add("eue.refreshtoken", password);
}
}
}
protected Path createFile(final EueResourceIdProvider fileid, Path file, final byte[] content) throws Exception {
final EueWriteFeature feature = new EueWriteFeature(session, fileid);
final TransferStatus status = new TransferStatus()
@@ -19,11 +19,9 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
@@ -37,8 +35,6 @@ import org.junit.Before;
import java.util.Collections;
import java.util.HashSet;
import static org.junit.Assert.fail;
public class AbstractFreenetTest extends VaultTest {
protected FreenetSession session;
@@ -54,21 +50,11 @@ public class AbstractFreenetTest extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/freenet.cyberduckprofile"));
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
PROPERTIES.get("freenet.user"), PROPERTIES.get("freenet.password")
PROPERTIES.get("freenet.user")
));
session = new FreenetSession(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;
}
@Override
public void warn(final Host bookmark, final String title, final String message, final String continueButton, final String disconnectButton, final String preference) {
//
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(),
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
}
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.cryptomator.CryptoVault;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -76,42 +74,4 @@ public class AbstractDriveTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Google Drive (cyberduck) OAuth2 Refresh Token")) {
return PROPERTIES.get("googledrive.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("Google Drive (cyberduck) OAuth2 Access Token")) {
return PROPERTIES.get("googledrive.accesstoken");
}
if(user.equals("Google Drive (cyberduck) OAuth2 Refresh Token")) {
return PROPERTIES.get("googledrive.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Google Drive (cyberduck) OAuth2 Refresh Token")) {
VaultTest.add("googledrive.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Google Drive (cyberduck) OAuth2 Access Token")) {
VaultTest.add("googledrive.accesstoken", password);
}
if(user.equals("Google Drive (cyberduck) OAuth2 Refresh Token")) {
VaultTest.add("googledrive.refreshtoken", password);
}
}
}
}
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.cryptomator.CryptoVault;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -78,42 +76,4 @@ public class AbstractGoogleStorageTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
private static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Refresh Token")) {
return PROPERTIES.get("googlestorage.tokenexpiry");
}
return null;
}
@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 PROPERTIES.get("googlestorage.accesstoken");
}
if(user.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Refresh Token")) {
return PROPERTIES.get("googlestorage.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Google Drive (cyberduck) OAuth2 Refresh Token")) {
VaultTest.add("googledrive.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Access Token")) {
VaultTest.add("googlestorage.accesstoken", password);
}
if(user.equals("Google Cloud Storage (api-project-408246103372) OAuth2 Refresh Token")) {
VaultTest.add("googlestorage.refreshtoken", password);
}
}
}
}
@@ -21,7 +21,6 @@ import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.HostPasswordStore;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
@@ -66,7 +65,7 @@ public abstract class AbstractGraphTest extends VaultTest {
fail(reason);
return null;
}
}, new DisabledHostKeyCallback(), passwordStore(),
}, new DisabledHostKeyCallback(), new TestPasswordStore(),
new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
@@ -75,8 +74,6 @@ public abstract class AbstractGraphTest extends VaultTest {
protected abstract InputStream profile();
protected abstract HostPasswordStore passwordStore();
protected abstract GraphSession session(final Host host, final X509TrustManager trust, final X509KeyManager key);
protected abstract String user();
@@ -15,15 +15,11 @@ package ch.cyberduck.core.onedrive;
* GNU General Public License for more details.
*/
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.HostPasswordStore;
import ch.cyberduck.core.Protocol;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.cryptomator.CryptoVault;
import ch.cyberduck.core.ssl.X509KeyManager;
import ch.cyberduck.core.ssl.X509TrustManager;
import ch.cyberduck.test.VaultTest;
import org.junit.runners.Parameterized;
@@ -50,11 +46,6 @@ public abstract class AbstractOneDriveTest extends AbstractGraphTest {
return this.getClass().getResourceAsStream("/Microsoft OneDrive.cyberduckprofile");
}
@Override
protected HostPasswordStore passwordStore() {
return new TestPasswordStore();
}
@Override
protected String user() {
return PROPERTIES.get("onedrive.user");
@@ -64,42 +55,4 @@ public abstract class AbstractOneDriveTest extends AbstractGraphTest {
protected GraphSession session(final Host host, final X509TrustManager trust, final X509KeyManager key) {
return (session = new OneDriveSession(host, trust, key));
}
public final static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Token Expiry")) {
return PROPERTIES.get("onedrive.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.endsWith("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Access Token")) {
return PROPERTIES.get("onedrive.accesstoken");
}
if(user.endsWith("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Refresh Token")) {
return PROPERTIES.get("onedrive.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Token Expiry")) {
VaultTest.add("onedrive.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Access Token")) {
VaultTest.add("onedrive.accesstoken", password);
}
if(user.equals("Microsoft OneDrive (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Refresh Token")) {
VaultTest.add("onedrive.refreshtoken", password);
}
}
}
}
@@ -15,14 +15,10 @@ package ch.cyberduck.core.onedrive;
* GNU General Public License for more details.
*/
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.HostPasswordStore;
import ch.cyberduck.core.Protocol;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.ssl.X509KeyManager;
import ch.cyberduck.core.ssl.X509TrustManager;
import ch.cyberduck.test.VaultTest;
import java.io.InputStream;
@@ -49,45 +45,4 @@ public abstract class AbstractSharepointTest extends AbstractGraphTest {
return PROPERTIES.get("sharepoint.user");
}
@Override
protected HostPasswordStore passwordStore() {
return new DisabledPasswordStore() {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Token Expiry")) {
return PROPERTIES.get("sharepoint.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.endsWith("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Access Token")) {
return PROPERTIES.get("sharepoint.accesstoken");
}
if(user.endsWith("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Refresh Token")) {
return PROPERTIES.get("sharepoint.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Token Expiry")) {
VaultTest.add("sharepoint.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Access Token")) {
VaultTest.add("sharepoint.accesstoken", password);
}
if(user.equals("Microsoft SharePoint (sharepoint@iterategmbh.onmicrosoft.com) OAuth2 Refresh Token")) {
VaultTest.add("sharepoint.refreshtoken", password);
}
}
};
}
}
@@ -19,7 +19,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -55,7 +54,7 @@ public abstract class AbstractSwiftTest extends VaultTest {
@Before
public void setup() throws Exception {
session = new SwiftSession(new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials(
PROPERTIES.get("rackspace.user"), PROPERTIES.get("rackspace.password")
PROPERTIES.get("rackspace.user")
)), new DisabledX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@Override
@@ -64,7 +63,7 @@ public abstract class AbstractSwiftTest extends VaultTest {
return null;
}
}, new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener());
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
}
@@ -21,7 +21,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
@@ -79,7 +78,7 @@ public class SwiftSingleTransferWorkerTest extends VaultTest {
IOUtils.write(content, out);
out.close();
final Host host = new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials(
PROPERTIES.get("rackspace.user"), PROPERTIES.get("rackspace.password")
PROPERTIES.get("rackspace.user")
)) {
@Override
public String getProperty(final String key) {
@@ -124,8 +123,8 @@ public class SwiftSingleTransferWorkerTest extends VaultTest {
};
new LoginConnectionService(new DisabledLoginCallback(),
new DisabledHostKeyCallback(),
new DisabledPasswordStore(),
new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
new TestPasswordStore(),
new DisabledProgressListener()).check(session, new DisabledCancelCallback());
final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume));
container.attributes().setRegion("IAD");
final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.cryptomator.CryptoVault;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
@@ -80,48 +78,4 @@ public class AbstractOcisTest extends VaultTest {
}, new DisabledHostKeyCallback(), new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("ownCloud Infinite Scale (admin) OAuth2 Token Expiry")) {
return PROPERTIES.get("ocis.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("ownCloud Infinite Scale (admin) OAuth2 Access Token")) {
return PROPERTIES.get("ocis.accesstoken");
}
if(user.equals("ownCloud Infinite Scale (admin) OIDC Id Token")) {
return PROPERTIES.get("ocis.idtoken");
}
if(user.equals("ownCloud Infinite Scale (admin) OAuth2 Refresh Token")) {
return PROPERTIES.get("ocis.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("ownCloud Infinite Scale (admin) OAuth2 Token Expiry")) {
VaultTest.add("ocis.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("ownCloud Infinite Scale (admin) OAuth2 Access Token")) {
VaultTest.add("ocis.accesstoken", password);
}
if(user.equals("ownCloud Infinite Scale (admin) OIDC Id Token")) {
VaultTest.add("ocis.idtoken", password);
}
if(user.equals("ownCloud Infinite Scale (admin) OAuth2 Refresh Token")) {
VaultTest.add("ocis.refreshtoken", password);
}
}
}
}
@@ -76,7 +76,7 @@ public abstract class AbstractS3Test extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/S3 (HTTPS).cyberduckprofile"));
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
PROPERTIES.get("s3.key"), PROPERTIES.get("s3.secret")
PROPERTIES.get("s3.key")
));
session = new S3Session(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@@ -86,7 +86,7 @@ public abstract class AbstractS3Test extends VaultTest {
return null;
}
}, new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener());
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
@@ -96,7 +96,7 @@ public abstract class AbstractS3Test extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/S3 (HTTPS).cyberduckprofile"));
final Host host = new Host(profile, "test-eu-central-1-cyberduck.s3.amazonaws.com", new Credentials(
PROPERTIES.get("s3.key"), PROPERTIES.get("s3.secret")
PROPERTIES.get("s3.key")
));
virtualhost = new S3Session(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@@ -106,7 +106,7 @@ public abstract class AbstractS3Test extends VaultTest {
return null;
}
}, new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener());
new TestPasswordStore(), new DisabledProgressListener());
login.check(virtualhost, new DisabledCancelCallback());
}
@@ -19,7 +19,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
@@ -54,7 +53,7 @@ public class AbstractSpectraTest extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/Spectra S3 (HTTPS).cyberduckprofile"));
final Host host = new Host(profile, PROPERTIES.get("spectra.hostname"), Integer.parseInt(PROPERTIES.get("spectra.port")), new Credentials(
PROPERTIES.get("spectra.user"), PROPERTIES.get("spectra.key")
PROPERTIES.get("spectra.user")
));
session = new SpectraSession(host, new DisabledX509TrustManager(),
new DefaultX509KeyManager());
@@ -65,7 +64,7 @@ public class AbstractSpectraTest extends VaultTest {
return null;
}
}, new DisabledHostKeyCallback(),
new DisabledPasswordStore(), new DisabledProgressListener());
new TestPasswordStore(), new DisabledProgressListener());
connect.check(session, new DisabledCancelCallback());
}
}
@@ -22,7 +22,6 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
@@ -95,7 +94,7 @@ public class SpectraSingleTransferWorkerTest extends VaultTest {
return Scheme.http;
}
}, PROPERTIES.get("spectra.hostname"), Integer.parseInt(PROPERTIES.get("spectra.port")), new Credentials(
PROPERTIES.get("spectra.user"), PROPERTIES.get("spectra.key")
PROPERTIES.get("spectra.user")
));
final BytecountStreamListener counter = new BytecountStreamListener();
final AtomicBoolean failed = new AtomicBoolean();
@@ -150,8 +149,8 @@ public class SpectraSingleTransferWorkerTest extends VaultTest {
};
new LoginConnectionService(new DisabledLoginCallback(),
new DisabledHostKeyCallback(),
new DisabledPasswordStore(),
new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
new TestPasswordStore(),
new DisabledProgressListener()).check(session, new DisabledCancelCallback());
final Path container = new SpectraDirectoryFeature(session).mkdir(
new SpectraWriteFeature(session), new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.core.ssl.DefaultX509KeyManager;
import ch.cyberduck.core.ssl.DefaultX509TrustManager;
@@ -66,42 +64,4 @@ public class AbstractStoregateTest extends VaultTest {
new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(final String serviceName, final String accountName) {
if(accountName.equals("Storegate (mduck) OAuth2 Token Expiry")) {
return PROPERTIES.get("storegate.tokenexpiry");
}
return null;
}
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
if(user.equals("Storegate (mduck) OAuth2 Access Token")) {
return PROPERTIES.get("storegate.accesstoken");
}
if(user.equals("Storegate (mduck) OAuth2 Refresh Token")) {
return PROPERTIES.get("storegate.refreshtoken");
}
return null;
}
@Override
public void addPassword(final String serviceName, final String accountName, final String password) {
if(accountName.equals("Storegate (mduck) OAuth2 Token Expiry")) {
VaultTest.add("storegate.tokenexpiry", password);
}
}
@Override
public void addPassword(final Scheme scheme, final int port, final String hostname, final String user, final String password) {
if(user.equals("Storegate (mduck) OAuth2 Access Token")) {
VaultTest.add("storegate.accesstoken", password);
}
if(user.equals("Storegate (mduck) OAuth2 Refresh Token")) {
VaultTest.add("storegate.refreshtoken", password);
}
}
}
}
@@ -90,18 +90,6 @@ public class DAVSessionTest extends AbstractDAVTest {
public void testLoginBasicAuth() {
}
@Test
public void testLoginNTLM() throws Exception {
final Host host = new Host(new DAVProtocol(), "winbuild.iterate.ch", new Credentials(
PROPERTIES.get("webdav.iis.user"), PROPERTIES.get("webdav.iis.password")
));
host.setDefaultPath("/WebDAV");
final DAVSession session = new DAVSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
session.open(new DisabledProxyFinder(), new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
session.login(new DisabledLoginCallback(), new DisabledCancelCallback());
session.close();
}
@Test
public void testTouch() throws Exception {
final Path test = new DAVTouchFeature(session).touch(new DAVWriteFeature(session), new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
@@ -19,14 +19,12 @@ import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledCancelCallback;
import ch.cyberduck.core.DisabledHostKeyCallback;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordStore;
import ch.cyberduck.core.DisabledProgressListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.LoginConnectionService;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.dav.DAVProtocol;
import ch.cyberduck.core.dav.DAVSession;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
@@ -57,7 +55,7 @@ public class AbstractMicrosoftIISDAVTest extends VaultTest {
final Profile profile = new ProfilePlistReader(factory).read(
this.getClass().getResourceAsStream("/DAV.cyberduckprofile"));
session = new DAVSession(new Host(profile, "winbuild.iterate.ch", profile.getDefaultPort(), "/WebDAV", new Credentials(
PROPERTIES.get("webdav.iis.user"), PROPERTIES.get("webdav.iis.password")
PROPERTIES.get("webdav.iis.user")
)), new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@Override
@@ -73,11 +71,4 @@ public class AbstractMicrosoftIISDAVTest extends VaultTest {
}, new DisabledHostKeyCallback(), new TestPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
}
public static class TestPasswordStore extends DisabledPasswordStore {
@Override
public String getPassword(Scheme scheme, int port, String hostname, String user) {
return PROPERTIES.get("webdav.iis.password");
}
}
}