From b3f849e65e5e5f8a540b8ace27e12afedf55b2fe Mon Sep 17 00:00:00 2001 From: Ralph Plawetzki Date: Fri, 27 Sep 2024 09:19:21 +0200 Subject: [PATCH] Prepare release 1.0.0 --- pom.xml | 6 +++--- .../integrations/keychain/BitwardenAccess.java | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 95f4ce7..7d20887 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.purejava cryptomator-bitwarden - 0.5.0-SNAPSHOT + 1.0.0 cryptomator-bitwarden Plug-in for Cryptomator to store vault passwords in Bitwarden @@ -36,7 +36,7 @@ UTF-8 1.4.0 - 0.5.0-SNAPSHOT + 1.0.0 5.11.0 2.0.16 @@ -56,7 +56,7 @@ com.bitwarden - sdk + sdk-secrets ${bitwarden.version} diff --git a/src/main/java/org/purejava/integrations/keychain/BitwardenAccess.java b/src/main/java/org/purejava/integrations/keychain/BitwardenAccess.java index 7d27169..3957490 100644 --- a/src/main/java/org/purejava/integrations/keychain/BitwardenAccess.java +++ b/src/main/java/org/purejava/integrations/keychain/BitwardenAccess.java @@ -21,6 +21,7 @@ public class BitwardenAccess implements KeychainAccessProvider { private BitwardenClient bitwardenClient; private final String accessToken; private UUID organizationId = null; + private final String stateFile; private boolean isSupported = false; private final String boID; private final String apiUrl = "https://api.bitwarden.com"; @@ -30,6 +31,7 @@ public class BitwardenAccess implements KeychainAccessProvider { public BitwardenAccess() { this.accessToken = System.getenv("BITWARDEN_ACCESS_TOKEN"); this.boID = System.getenv("BITWARDEN_ORGANIZATION_ID"); + this.stateFile = System.getenv("BITWARDEN_STATE_FILE"); if (isEnvVarValid(accessToken) && isEnvVarValid(boID)) { try { @@ -37,7 +39,7 @@ public BitwardenAccess() { this.bitwardenSettings.setApiUrl(apiUrl); this.bitwardenSettings.setIdentityUrl(identityUrl); this.bitwardenClient = new BitwardenClient(bitwardenSettings); - this.bitwardenClient.accessTokenLogin(accessToken); + this.bitwardenClient.auth().loginAccessToken(accessToken, stateFile); this.isSupported = true; } catch (BitwardenClientException | IllegalArgumentException e) { @@ -56,17 +58,17 @@ public BitwardenAccess() { public boolean isLocked() { return false; } @Override - public void storePassphrase(String vault, CharSequence password) throws KeychainAccessException { - storePassphrase(vault, "Vault", password); + public void storePassphrase(String vault, String displayName, CharSequence password) throws KeychainAccessException { + storePassphrase(vault, displayName, password, false); } @Override - public void storePassphrase(String vault, String name, CharSequence password) throws KeychainAccessException { + public void storePassphrase(String vault, String name, CharSequence password, boolean requireOsAuthentication) throws KeychainAccessException { try { var projectId = getprojectId(); var secret = getSecret(vault); if (secret.isEmpty()) { - bitwardenClient.secrets().create(vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId }); + bitwardenClient.secrets().create(organizationId, vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId }); } LOG.debug("Passphrase successfully stored"); } catch (BitwardenClientException | IllegalArgumentException e) { @@ -119,7 +121,7 @@ public void changePassphrase(String vault, String name, CharSequence password) t LOG.debug("Passphrase not found"); } else { LOG.debug("Passphrase found and updated"); - bitwardenClient.secrets().update(secret.get().getID(), vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId }); + bitwardenClient.secrets().update(organizationId, secret.get().getID(), vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId }); } } catch (BitwardenClientException | IllegalArgumentException e) { throw new KeychainAccessException("Updating the passphrase failed", e);