From 162ebb40d9c28d89eaff5522a261d3028584696b 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 | 8 ++++---- .../purejava/integrations/keychain/BitwardenAccess.java | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 95f4ce7..d54ade4 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 @@ -35,8 +35,8 @@ UTF-8 - 1.4.0 - 0.5.0-SNAPSHOT + 1.3.1 + 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..93a173d 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) { @@ -66,7 +68,7 @@ public void storePassphrase(String vault, String name, CharSequence password) th 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);