An OpenID Connect Identity Provider implementing OAuth 2.0 Authorization Code flow with PKCE - mirror
  • Rust 88%
  • Python 4%
  • HTML 3.4%
  • JavaScript 2.3%
  • Shell 1%
  • Other 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Till Wegmüller b796fb7d92
Some checks failed
CI / Test (push) Has been cancelled
CI / Docker Build Check (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
ci: cover Continue page navigation guard (#17)
2026-10-15 21:28:48 +02:00
.claude Add Claude settings 2026-02-08 18:58:06 +01:00
.config Initial commit: Barycenter OpenID Connect Identity Provider 2025-11-29 12:17:01 +01:00
.github/workflows ci: cover Continue page navigation guard (#17) 2026-10-15 21:28:48 +02:00
book Repair browser federation and serve authoritative WebFinger 2026-10-03 22:20:10 +02:00
cli fix: guide invitation recipients through account setup (#11) 2026-10-06 10:53:59 +02:00
client-wasm WIP Passkey implementation. Needs fixing storage.rs and more tests 2025-12-07 13:18:22 +01:00
deploy fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
docs fix: guide invitation recipients through account setup (#11) 2026-10-06 10:53:59 +02:00
Formula Add operator-issued single-use email password recovery 2026-10-03 22:05:42 +02:00
migration fix: stop duplicate federation callbacks and explain rejected ones (#13) 2026-10-14 22:07:00 +02:00
scripts feat: Add token introspection endpoint, docs, and validation scripts 2026-03-19 20:30:31 +00:00
src fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
static fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
tests chore: make clippy -D warnings pass on Rust 1.99 (#14) 2026-10-14 22:15:42 +02:00
.dockerignore fix: retain embedded login copy in Docker build context 2026-10-04 00:48:18 +02:00
.gitignore chore: make clippy -D warnings pass on Rust 1.99 (#14) 2026-10-14 22:15:42 +02:00
AGENTS.md fix: provide actionable admin CLI diagnostics (#10) 2026-10-06 10:18:31 +02:00
Cargo.lock fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
Cargo.toml fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
CHANGELOG.md fix: refresh cached Continue script for returning browsers (#16) 2026-10-14 22:44:49 +02:00
CLAUDE.md fix: provide actionable admin CLI diagnostics (#10) 2026-10-06 10:18:31 +02:00
config.toml fix: guide invitation recipients through account setup (#11) 2026-10-06 10:53:59 +02:00
CONTRIBUTING.md fix: provide actionable admin CLI diagnostics (#10) 2026-10-06 10:18:31 +02:00
DEPLOYMENT.md refactor: update crabidp references to barycenter and add Gateway API support 2025-11-29 15:38:07 +01:00
docker-compose.yml refactor: update crabidp references to barycenter and add Gateway API support 2025-11-29 15:38:07 +01:00
Dockerfile feat: identify accounts before native or federated password login 2026-10-04 00:46:56 +02:00
README.md feat: add single-use email onboarding and admin CLI 2026-10-03 14:18:04 +02:00
RELEASE.md ci: add automated release workflow with Docker image publishing 2025-11-29 15:49:52 +01:00
users.json.example feat: add admin GraphQL API, background jobs, and user sync CLI 2025-11-30 18:06:50 +01:00

Barycenter

An OpenID Connect Identity Provider (IdP) implementing OAuth 2.0 Authorization Code flow with PKCE.

Overview

Barycenter is a lightweight, standards-compliant OpenID Connect Identity Provider written in Rust. It implements the OAuth 2.0 Authorization Code flow with Proof Key for Code Exchange (PKCE), making it suitable for modern web and mobile applications.

Features

  • OAuth 2.0 Authorization Code Flow with PKCE (S256)
  • Dynamic Client Registration - RFC 7591 compliant
  • Token Endpoint - Multiple authentication methods (client_secret_basic, client_secret_post)
  • ID Token Signing - RS256 with proper at_hash and nonce support
  • UserInfo Endpoint - Bearer token authentication
  • Discovery - OpenID Connect Discovery and JWKS publication
  • Property Storage - Simple key-value storage for user properties

Technology Stack

  • Language: Rust
  • Web Framework: axum
  • Database: SQLite via SeaORM
  • Cryptography: josekit for JOSE/JWT operations
  • Configuration: config-rs with TOML support

Quick Start

Prerequisites

  • Rust 1.70 or later
  • SQLite 3

Installation

# Clone the repository
git clone https://github.com/CloudNebulaProject/barycenter.git
cd barycenter

# Build the project
cargo build --release

Configuration

Create a config.toml file (see config.toml for example):

[server]
host = "127.0.0.1"
port = 8080
public_base_url = "http://localhost:8080"

[database]
connection_string = "sqlite://barycenter.db?mode=rwc"

[keys]
jwks_path = "data/jwks.json"
private_key_path = "data/private_key.pem"
signing_algorithm = "RS256"

Running

# Run with default config
cargo run

# Run with custom config
cargo run -- --config path/to/config.toml

# Run with debug logging
RUST_LOG=debug cargo run

Development

Building

# Debug build
cargo build

# Release build
cargo build --release

# Check without building
cargo check

Testing

This project uses cargo-nextest for running tests.

# Install nextest (one-time setup)
cargo install cargo-nextest

# Run all tests
cargo nextest run

# Run tests with logging
RUST_LOG=debug cargo nextest run

Logging

Set the RUST_LOG environment variable to control logging levels:

# Debug level for all modules
RUST_LOG=debug cargo run

# Trace level for barycenter only
RUST_LOG=barycenter=trace cargo run

API Endpoints

Discovery

  • GET /.well-known/openid-configuration - OpenID Provider metadata
  • GET /.well-known/jwks.json - Public signing keys

OAuth/OIDC

  • GET /authorize - Authorization endpoint
  • POST /token - Token endpoint
  • GET /userinfo - UserInfo endpoint
  • POST /connect/register - Dynamic client registration

Properties (Non-standard)

  • GET /properties/:owner/:key - Get property value
  • PUT /properties/:owner/:key - Set property value

Project Status

This is an early-stage implementation. See docs/next-iteration-plan.md for planned features and docs/oidc-conformance.md for OpenID Connect compliance details.

Currently Implemented:

  • Authorization Code flow with PKCE (S256)
  • Dynamic client registration
  • Token issuance with RS256 ID Token signing (at_hash, nonce, auth_time, AMR, ACR)
  • UserInfo endpoint
  • Token endpoint with client_secret_basic and client_secret_post
  • User authentication with sessions (password + passkey/WebAuthn)
  • Two-factor authentication (admin-enforced, context-based)
  • Consent flow with database persistence
  • Refresh token grant with rotation
  • Token revocation (RFC 7009) and introspection (RFC 7662)
  • Device Authorization Grant (RFC 8628)
  • Admin GraphQL API

Pending Implementation:

  • OpenID Federation trust chain validation
  • User account management UI
  • Key rotation and multi-key JWKS

Deployment

Barycenter supports multiple deployment platforms:

  • Docker: Pre-built images available at ghcr.io/[owner]/barycenter
  • Kubernetes: Helm chart with Ingress and Gateway API support
  • Linux: systemd service with security hardening
  • FreeBSD: rc.d init script
  • illumos/Solaris: SMF manifest

See DEPLOYMENT.md for detailed installation instructions for each platform.

Quick Start with Docker

docker pull ghcr.io/[owner]/barycenter:latest
docker run -p 8080:8080 -v barycenter-data:/app/data ghcr.io/[owner]/barycenter:latest

Quick Start with Helm

helm install barycenter ./deploy/helm/barycenter \
  --namespace barycenter \
  --create-namespace

Email onboarding and macOS admin CLI

See the CLI guide for single-use, expiring invitation links, Homebrew installation, SMTP configuration, resend and revocation. The dedicated admin endpoint is disabled until its own bearer-token file is provisioned.

Releases

For maintainers: see RELEASE.md for the release process.

To create a new release:

cargo install cargo-release
cargo release minor --execute  # Bumps version and creates release

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, development workflow, and the process for submitting pull requests.

License

[Add your license here]

Acknowledgments

Built with support from the OpenID Connect and OAuth 2.0 communities.