Updated dependencies

This commit is contained in:
Sebastian Stenzel
2017-02-24 16:48:15 +01:00
parent f391a6521d
commit 277999112e
5 changed files with 58 additions and 38 deletions
@@ -31,7 +31,7 @@ public class WindowsProtectedKeychainAccessTest {
WinFunctions winFunctions = Mockito.mock(WinFunctions.class);
WinDataProtection winDataProtection = Mockito.mock(WinDataProtection.class);
Mockito.when(winFunctions.dataProtection()).thenReturn(winDataProtection);
Answer<byte[]> answerReturningFirstArg = invocation -> invocation.getArgumentAt(0, byte[].class).clone();
Answer<byte[]> answerReturningFirstArg = invocation -> ((byte[]) invocation.getArgument(0)).clone();
Mockito.when(winDataProtection.protect(Mockito.any(), Mockito.any())).thenAnswer(answerReturningFirstArg);
Mockito.when(winDataProtection.unprotect(Mockito.any(), Mockito.any())).thenAnswer(answerReturningFirstArg);
keychain = new WindowsProtectedKeychainAccess(Optional.of(winFunctions));
+16 -14
View File
@@ -27,22 +27,25 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dependency versions -->
<cryptomator.cryptolib.version>1.0.9</cryptomator.cryptolib.version>
<cryptomator.cryptofs.version>1.1.0-SNAPSHOT</cryptomator.cryptofs.version>
<cryptomator.webdav.version>0.3.0-SNAPSHOT</cryptomator.webdav.version>
<cryptomator.cryptolib.version>1.1.0</cryptomator.cryptolib.version>
<cryptomator.cryptofs.version>1.1.0</cryptomator.cryptofs.version>
<cryptomator.webdav.version>0.4.0-SNAPSHOT</cryptomator.webdav.version>
<cryptomator.jni.version>1.0.0</cryptomator.jni.version>
<log4j.version>2.1</log4j.version>
<slf4j.version>1.7.7</slf4j.version>
<slf4j.version>1.7.22</slf4j.version>
<junit.version>4.12</junit.version>
<junit.hierarchicalrunner.version>4.12.1</junit.hierarchicalrunner.version>
<hamcrest.version>1.3</hamcrest.version> <!-- keep in sync with version required by JUnit -->
<commons-io.version>2.4</commons-io.version>
<commons-collections.version>4.0</commons-collections.version>
<commons-lang3.version>3.4</commons-lang3.version>
<commons-lang3.version>3.5</commons-lang3.version>
<commons-codec.version>1.10</commons-codec.version>
<commons-httpclient.version>3.1</commons-httpclient.version>
<mockito.version>1.10.19</mockito.version>
<dagger.version>2.6.1</dagger.version>
<mockito.version>2.7.9</mockito.version>
<dagger.version>2.8</dagger.version>
<easybind.version>1.0.3</easybind.version>
<guava.version>21.0</guava.version>
<gson.version>2.8.0</gson.version>
</properties>
<repositories>
@@ -159,14 +162,14 @@
<dependency>
<groupId>org.fxmisc.easybind</groupId>
<artifactId>easybind</artifactId>
<version>1.0.3</version>
<version>${easybind.version}</version>
</dependency>
<!-- Guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<version>${guava.version}</version>
</dependency>
<!-- DI -->
@@ -186,7 +189,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<version>${gson.version}</version>
</dependency>
<!-- JUnit / Mockito / Hamcrest -->
@@ -267,8 +270,8 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-libs</id>
@@ -285,7 +288,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<version>0.7.9</version>
<executions>
<execution>
<id>prepare-agent</id>
@@ -305,9 +308,8 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@@ -317,7 +317,8 @@ public class UnlockController extends LocalizedFXMLViewController {
private void unlock(CharSequence password) {
try {
vault.activateFrontend(password);
vault.unlock(password);
vault.mount();
vault.reveal();
Platform.runLater(() -> {
messageText.setText(null);
@@ -105,7 +105,8 @@ public class UnlockedController extends LocalizedFXMLViewController {
@FXML
private void didClickLockVault(ActionEvent event) {
asyncTaskService.asyncTaskOf(() -> {
vault.get().deactivateFrontend();
vault.get().unmount();
vault.get().lock();
}).onSuccess(() -> {
listener.ifPresent(listener -> listener.didLock(this));
}).onError(Exception.class, () -> {
@@ -16,7 +16,8 @@ import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
@@ -33,8 +34,10 @@ import org.cryptomator.cryptolib.api.InvalidPassphraseException;
import org.cryptomator.frontend.webdav.WebDavServer;
import org.cryptomator.frontend.webdav.mount.Mounter.CommandFailedException;
import org.cryptomator.frontend.webdav.mount.Mounter.Mount;
import org.cryptomator.frontend.webdav.mount.Mounter.MountParam;
import org.cryptomator.frontend.webdav.servlet.WebDavServletController;
import org.cryptomator.ui.model.VaultModule.PerVault;
import org.cryptomator.ui.settings.Settings;
import org.cryptomator.ui.settings.VaultSettings;
import org.cryptomator.ui.util.DeferredCloser;
import org.fxmisc.easybind.EasyBind;
@@ -52,6 +55,7 @@ public class Vault {
private static final Logger LOG = LoggerFactory.getLogger(Vault.class);
private static final String MASTERKEY_FILENAME = "masterkey.cryptomator";
private final Settings settings;
private final VaultSettings vaultSettings;
private final WebDavServer server;
private final DeferredCloser closer;
@@ -63,7 +67,8 @@ public class Vault {
private Mount mount;
@Inject
Vault(VaultSettings vaultSettings, WebDavServer server, DeferredCloser closer) {
Vault(Settings settings, VaultSettings vaultSettings, WebDavServer server, DeferredCloser closer) {
this.settings = settings;
this.vaultSettings = vaultSettings;
this.server = server;
this.closer = closer;
@@ -106,9 +111,7 @@ public class Vault {
CryptoFileSystemProvider.changePassphrase(getPath(), MASTERKEY_FILENAME, oldPassphrase, newPassphrase);
}
public synchronized void activateFrontend(CharSequence passphrase) {
boolean unlockSuccess = false;
boolean mountSuccess = false;
public synchronized void unlock(CharSequence passphrase) {
try {
FileSystem fs = getCryptoFileSystem(passphrase);
if (!server.isRunning()) {
@@ -116,29 +119,43 @@ public class Vault {
}
servlet = server.createWebDavServlet(fs.getPath("/"), vaultSettings.getId() + "/" + vaultSettings.mountName().get());
servlet.start();
unlockSuccess = true;
mount = servlet.mount(Collections.emptyMap());
mountSuccess = true;
Platform.runLater(() -> {
unlocked.set(true);
});
} catch (IOException e) {
LOG.error("Unable to provide filesystem", e);
} catch (CommandFailedException e) {
LOG.error("Unable to mount filesystem", e);
} finally {
// unlocked is a observable property and should only be changed by the FX application thread
final boolean finalUnlockSuccess = unlockSuccess;
final boolean finalMountSuccess = mountSuccess;
Platform.runLater(() -> {
unlocked.set(finalUnlockSuccess);
mounted.set(finalMountSuccess);
});
}
}
public synchronized void deactivateFrontend() throws Exception {
public synchronized void mount() {
if (servlet == null) {
throw new IllegalStateException("Mounting requires unlocked WebDAV servlet.");
}
Map<MountParam, String> mountOptions = new HashMap<>();
mountOptions.put(MountParam.WIN_DRIVE_LETTER, vaultSettings.winDriveLetter().get());
mountOptions.put(MountParam.PREFERRED_GVFS_SCHEME, settings.preferredGvfsScheme().get());
try {
mount = servlet.mount(mountOptions);
Platform.runLater(() -> {
mounted.set(true);
});
} catch (CommandFailedException e) {
LOG.error("Unable to mount filesystem", e);
}
}
public synchronized void unmount() throws Exception {
if (mount != null) {
mount.unmount();
}
Platform.runLater(() -> {
mounted.set(false);
});
}
public synchronized void lock() throws Exception {
if (servlet != null) {
servlet.stop();
}
@@ -147,7 +164,6 @@ public class Vault {
fs.close();
}
Platform.runLater(() -> {
mounted.set(false);
unlocked.set(false);
});
}