intelliworx.CredentialResolver.Bitwarden (1.0.0)
Installation
dotnet nuget add source --name Public --username your_username --password your_token dotnet add package --source Public --version 1.0.0 intelliworx.CredentialResolver.BitwardenAbout this package
Adds support for the Bitwarden password manager to the intelliworx.CredentialResolver
intelliworx Credential Resolver - Bitwarden Provider
A Bitwarden credential provider for intelliworx.CredentialResolver. Resolves credential placeholders in ASP.NET Core configuration with values from a Bitwarden vault using the Bitwarden CLI serve API.
Prerequisites
The Bitwarden CLI must be installed and running in serve mode:
bw serve --port 8087
The vault must be unlocked for credentials to be resolved. The provider checks the vault status and only operates when the status is unlocked.
Installation
dotnet add package intelliworx.CredentialResolver.Bitwarden
Quick Start
1. Register the Bitwarden Provider
Add the credential substitution as the last configuration source:
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddCredentialSubstitution(options =>
{
options.AddBitwarden()
.SetThrowExceptionOnMissingEntries(true);
});
2. Use Placeholders in Configuration
In your appsettings.json or any other configuration source:
{
"ConnectionStrings": {
"Default": "Server=db.example.com;Database=app;Password=<<bitwarden://search/sampledb/password>>"
},
"ExternalApi": {
"ApiKey": "<<bitwarden://search/external-service/api-key>>"
}
}
At runtime, the placeholders are replaced with the actual credential values fetched from Bitwarden.
URI Format
<<bitwarden://search/{searchTerm}/{fieldName}>>
- scheme —
bitwardenorbw - search — the operation to perform (currently the only supported host)
- searchTerm — the Bitwarden vault item name to search for
- fieldName — which field to return from the matched entry
Supported Fields
| Field | Description |
|---|---|
username |
The login username |
password |
The login password |
notes |
The secure notes of the entry |
| custom field name | Any custom field attached to the entry (matched case-insensitively) |
Examples
<<bitwarden://search/prod-database/password>>
<<bw://search/prod-database/username>>
<<bitwarden://search/smtp-server/notes>>
<<bitwarden://search/external-api/my-custom-field>>
Configuration
Customize the provider using the options callback:
builder.Configuration.AddCredentialSubstitution(options =>
{
options.AddBitwarden(bw =>
{
bw.BaseUrl = new Uri("http://localhost:9000/");
bw.HttpClientFactory = () => new HttpClient();
});
});
Options
| Property | Type | Default | Description |
|---|---|---|---|
BaseUrl |
Uri |
http://localhost:8087/ |
Base URL of the Bitwarden CLI serve API |
HttpClientFactory |
Func<HttpClient> |
() => new HttpClient() |
Factory for creating the HttpClient used for API calls |
Multiple Providers
Combine Bitwarden with other credential resolvers:
builder.Configuration.AddCredentialSubstitution(options =>
{
options.AddBitwarden()
.AddResolver(new AzureKeyVaultResolver())
.SetThrowExceptionOnMissingEntries(true);
});
Each placeholder is routed to the correct resolver based on its URI scheme.
Requirements
- .NET 9.0 or later
intelliworx.CredentialResolver>= 1.0- Bitwarden CLI (
bw) running in serve mode
License
GNU Affero General Public License v3 (AGPL-3.0)
Copyright (C) Bastian Krauss