# openstack/barbican architecture

> Architecture diagram of the GitHub repository openstack/barbican, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openstack/barbican
- Repository: https://github.com/openstack/barbican

## Overview

Barbican is an OpenStack REST service for securely storing, provisioning, and managing secrets and keys. A client request enters the WSGI/API stack, reaches versioned resource controllers, and uses validation and persistence; secret operations can invoke storage and crypto plugins. Orders also run through background task processing, which can record retries. The README documents symmetric, asymmetric, and raw secret lifecycles; the tree additionally shows containers, ACLs, quotas, consumers, and transport keys. Some controller and integration behavior is documented or indexed but not excerpted, so uncertain links are omitted.

Main entry points: [`barbican/queue/server.py`](https://github.com/openstack/barbican/blob/master/barbican/queue/server.py) (Queue RPC), [`barbican/model/repositories.py`](https://github.com/openstack/barbican/blob/master/barbican/model/repositories.py) (Persistence), [`barbican/plugin/resources.py`](https://github.com/openstack/barbican/blob/master/barbican/plugin/resources.py) (Secret operations), [`barbican/api/app.py`](https://github.com/openstack/barbican/blob/master/barbican/api/app.py) (API application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and policy"]
  node_wsgi["WSGI entry<br/>[api.py]"]
  node_app["API application<br/>[app.py]"]
  node_versions["Version routing<br/>[versions.py]"]
  node_controllers["Resource controllers"]
  node_validation["Request validation<br/>[validators.py]"]
  node_policy["Access policy<br/>[policy.py]"]
end

subgraph group_domain["Secret domain"]
  node_secretdata["Secret operations<br/>[resources.py]"]
  node_orders["Order processing<br/>[resources.py]"]
  node_models["Domain models<br/>[models.py]"]
  node_repository[("Persistence<br/>[repositories.py]")]
end

subgraph group_plugins["Crypto and storage"]
  node_crypto["Crypto selection<br/>[manager.py]"]
  node_cryptoplugins["Crypto backends"]
  node_storageplugins["Secret-store plugins"]
end

subgraph group_async["Background processing"]
  node_rpc["Queue RPC<br/>[server.py]"]
  node_queueclient["Queue client<br/>[client.py]"]
  node_worker["Worker process<br/>[worker.py]"]
  node_retry["Retry scheduling<br/>[retry_scheduler.py]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_wsgi
node_wsgi -->|"loads application"| node_app
node_app -->|"creates controller"| node_versions
node_app -->|"initializes database"| node_repository
node_versions -->|"routes resources"| node_controllers
node_controllers -->|"validates input"| node_validation
node_controllers -.->|"checks permissions"| node_policy
node_secretdata -->|"persists metadata"| node_repository
node_secretdata -->|"selects crypto"| node_crypto
node_secretdata -->|"uses storage backend"| node_storageplugins
node_crypto -->|"loads implementations"| node_cryptoplugins
node_orders -->|"generates secrets"| node_secretdata
node_orders -->|"loads orders"| node_repository
node_rpc -->|"dispatches tasks"| node_orders
node_rpc -->|"stores retries"| node_repository
node_worker -->|"starts server"| node_rpc
node_queueclient -.->|"sends RPC"| node_rpc
node_retry -.->|"schedules retries"| node_rpc
node_models -.->|"stored by"| node_repository

click node_wsgi "https://github.com/openstack/barbican/blob/master/barbican/wsgi/api.py"
click node_app "https://github.com/openstack/barbican/blob/master/barbican/api/app.py"
click node_versions "https://github.com/openstack/barbican/blob/master/barbican/api/controllers/versions.py"
click node_controllers "https://github.com/openstack/barbican/tree/master/barbican/api/controllers"
click node_validation "https://github.com/openstack/barbican/blob/master/barbican/common/validators.py"
click node_policy "https://github.com/openstack/barbican/blob/master/barbican/common/policy.py"
click node_secretdata "https://github.com/openstack/barbican/blob/master/barbican/plugin/resources.py"
click node_orders "https://github.com/openstack/barbican/blob/master/barbican/tasks/resources.py"
click node_models "https://github.com/openstack/barbican/blob/master/barbican/model/models.py"
click node_repository "https://github.com/openstack/barbican/blob/master/barbican/model/repositories.py"
click node_crypto "https://github.com/openstack/barbican/blob/master/barbican/plugin/crypto/manager.py"
click node_cryptoplugins "https://github.com/openstack/barbican/tree/master/barbican/plugin/crypto"
click node_storageplugins "https://github.com/openstack/barbican/tree/master/barbican/plugin/interface"
click node_rpc "https://github.com/openstack/barbican/blob/master/barbican/queue/server.py"
click node_queueclient "https://github.com/openstack/barbican/blob/master/barbican/queue/client.py"
click node_worker "https://github.com/openstack/barbican/blob/master/barbican/cmd/worker.py"
click node_retry "https://github.com/openstack/barbican/blob/master/barbican/queue/retry_scheduler.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wsgi,node_app,node_versions,node_controllers,node_validation,node_policy,node_client toneBlue
class node_secretdata,node_orders,node_models,node_repository toneAmber
class node_crypto,node_cryptoplugins,node_storageplugins toneMint
class node_rpc,node_queueclient,node_worker,node_retry toneRose
```

## Components

### API and policy

- [WSGI entry](https://github.com/openstack/barbican/blob/master/barbican/wsgi/api.py): `barbican/wsgi/api.py`
- [API application](https://github.com/openstack/barbican/blob/master/barbican/api/app.py): `barbican/api/app.py`
- [Version routing](https://github.com/openstack/barbican/blob/master/barbican/api/controllers/versions.py): `barbican/api/controllers/versions.py`
- [Resource controllers](https://github.com/openstack/barbican/tree/master/barbican/api/controllers): `barbican/api/controllers`
- [Request validation](https://github.com/openstack/barbican/blob/master/barbican/common/validators.py): `barbican/common/validators.py`
- [Access policy](https://github.com/openstack/barbican/blob/master/barbican/common/policy.py): `barbican/common/policy.py`

### Secret domain

- [Secret operations](https://github.com/openstack/barbican/blob/master/barbican/plugin/resources.py): `barbican/plugin/resources.py`
- [Order processing](https://github.com/openstack/barbican/blob/master/barbican/tasks/resources.py): `barbican/tasks/resources.py`
- [Domain models](https://github.com/openstack/barbican/blob/master/barbican/model/models.py): `barbican/model/models.py`
- [Persistence](https://github.com/openstack/barbican/blob/master/barbican/model/repositories.py): `barbican/model/repositories.py`

### Crypto and storage

- [Crypto selection](https://github.com/openstack/barbican/blob/master/barbican/plugin/crypto/manager.py): `barbican/plugin/crypto/manager.py`
- [Crypto backends](https://github.com/openstack/barbican/tree/master/barbican/plugin/crypto): `barbican/plugin/crypto`
- [Secret-store plugins](https://github.com/openstack/barbican/tree/master/barbican/plugin/interface): `barbican/plugin/interface`

### Background processing

- [Queue RPC](https://github.com/openstack/barbican/blob/master/barbican/queue/server.py): `barbican/queue/server.py`
- [Queue client](https://github.com/openstack/barbican/blob/master/barbican/queue/client.py): `barbican/queue/client.py`
- [Worker process](https://github.com/openstack/barbican/blob/master/barbican/cmd/worker.py): `barbican/cmd/worker.py`
- [Retry scheduling](https://github.com/openstack/barbican/blob/master/barbican/queue/retry_scheduler.py): `barbican/queue/retry_scheduler.py`

### Other components

- **API client**

## Connections

- API client → WSGI entry: sends requests
- WSGI entry → API application: loads application (evidence: `barbican/wsgi/api.py`)
- API application → Version routing: creates controller (evidence: `barbican/api/app.py`)
- API application → Persistence: initializes database (evidence: `barbican/api/app.py`)
- Version routing → Resource controllers: routes resources (evidence: `barbican/api/controllers/versions.py`)
- Resource controllers → Request validation: validates input (evidence: `barbican/api/controllers/__init__.py`)
- Resource controllers → Access policy: checks permissions
- Secret operations → Persistence: persists metadata (evidence: `barbican/plugin/resources.py`)
- Secret operations → Crypto selection: selects crypto (evidence: `barbican/plugin/resources.py`)
- Secret operations → Secret-store plugins: uses storage backend (evidence: `barbican/plugin/resources.py`)
- Crypto selection → Crypto backends: loads implementations (evidence: `barbican/plugin/crypto/manager.py`)
- Order processing → Secret operations: generates secrets (evidence: `barbican/tasks/resources.py`)
- Order processing → Persistence: loads orders (evidence: `barbican/tasks/resources.py`)
- Queue RPC → Order processing: dispatches tasks (evidence: `barbican/queue/server.py`)
- Queue RPC → Persistence: stores retries (evidence: `barbican/queue/server.py`)
- Worker process → Queue RPC: starts server (evidence: `barbican/cmd/worker.py`)
- Queue client → Queue RPC: sends RPC (evidence: `barbican/queue/client.py`)
- Retry scheduling → Queue RPC: schedules retries
- Domain models → Persistence: stored by (evidence: `barbican/model/models.py`)
