Secrets Manager Java SDK

The Java language wrapper for interacting with the Bitwarden Secrets Manager. The SDK, like the Secrets Manager CLI built on-top of it, can be used to execute the following operations:

  • Authenticate using an access token.

  • Retrieve a single secret or all secrets in a project.

  • List all secrets, secrets in a project, or projects.

Hinweis

This SDK is a beta release. Therefore, some functionality may be missing.

Requirements

Setting up a Secrets Manager account prior to using the Java SDK is recommended. This includes:

GitHub Repository

Locate the Java GitHub repository here.

Create new Bitwarden client

Insert the created access token to authorize the Secrets Manager session:

Bash
BitwardenSettings bitwardenSettings = new BitwardenSettings(); bitwardenSettings.setApiUrl("https://api.bitwarden.com"); bitwardenSettings.setIdentityUrl("https://identity.bitwarden.com"); BitwardenClient bitwardenClient = new BitwardenClient(bitwardenSettings); bitwardenClient.accessTokenLogin("<access-token>");

Secrets Manager operations

Once the Bitwarden client has been created and authorized, Secrets Manager CLI commands can be passed into the client:

Projects

The project command is used to access, manipulate, and create projects. The scope of access assigned to your machine account will determine what actions can be completed with the project command.

create project

Bash
UUID organizationId = UUID.fromString("<organization-id>"); var projectResponse = bitwardenClient.projects().create(organizationId, "TestProject");

list projects

Bash
var projectsResponse = bitwardenClient.projects().list(organizationId);

update project

Bash
UUID projectId = projectResponse.getID(); projectResponse = bitwardenClient.projects().get(projectId); projectResponse = bitwardenClient.projects.update(projectId, organizationId, "TestProjectUpdated");

delete project

Bash
bitwardenClient.projects().delete(new UUID[]{projectId});

Secrets

The secret command is used to access, manipulate and create secrets. As with all commands, secrets and projects outside your access token's scope of access cannot be read or written-to.

create secret

Bash
String key = "key"; String value = "value"; String note = "note"; var secretResponse = bitwardenClient.secrets().create(key, value, note, organizationId, new UUID[]{projectId}); UUID secretId = secretResponse.getID();

update secret

Bash
bitwardenClient.secrets().update(secretId, key2, value2, note2, organizationId, new UUID[]{projectId});

list secrets

Bash
var secretIdentifiersResponse secretIdentifiersResponse = bitwardenClient.secrets().list(organizationId);

delete secret

Bash
bitwardenClient.secrets().delete(new UUID[]{secretId});

Machen Sie einen Vorschlag für diese Seite

Kontaktieren Sie unser Team vom Kundendienst

For technical, billing, product, and Family/Premium questions.

Name*
E-Mail-Adresse Ihres Bitwarden-Kontos*
Bestätigen Sie die E-Mail-Adresse des Kontos*
Produkt*
Bist du selbst gehostet?*
Betreff*
Nachricht...*

Cloud-Status

Status überprüfen

© 2024 Bitwarden, Inc. Bedingungen Datenschutz Cookie-Einstellungen Sitemap

Diese Website ist auf Deutsch verfügbar.
Go to EnglishStay Here