Vaultara is an enterprise-grade Identity and Access Management (IAM) platform built in Rust. It serves as a modern, high-performance alternative to Keycloak, providing comprehensive authentication and authorization capabilities.
- OAuth 2.0 / OpenID Connect - Full compliance with OAuth 2.0 and OIDC specifications
- Multiple Grant Types - Authorization Code, Client Credentials, Password, Refresh Token
- PKCE Support - Proof Key for Code Exchange for enhanced security
- Token Management - Access tokens, refresh tokens, and ID tokens with configurable lifetimes
- Multi-tenant Architecture - Complete tenant/realm isolation
- User Profiles - Comprehensive user profile management
- Account Security - Password policies, account lockout, failed login tracking
- MFA Ready - Infrastructure for TOTP, SMS, Email, and WebAuthn
- Role-Based Access Control (RBAC) - Flexible role assignment
- Permission Management - Fine-grained permissions with resource:action model
- Group Management - Hierarchical group structure with role inheritance
- Attribute-Based Access Control (ABAC) - Condition-based permissions (coming soon)
- Complete Audit Trail - Immutable audit logs for all operations
- Entity Versioning - Full history of all entity changes
- Soft Deletes - Data is never lost, only marked as deleted
- Client Registration - Programmatic and manual client creation
- Secret Management - Secure client secret generation and rotation
- Scope Configuration - Customizable scopes per client
- Redirect URI Validation - Strict redirect URI enforcement
- Session Tracking - Track all active user sessions
- Session Revocation - Revoke individual or all user sessions
- Session Metadata - IP address, user agent tracking
- JWT Key Rotation - Automatic key rotation support
- Password Hashing - Argon2id password hashing
- CORS Configuration - Configurable cross-origin support
- Rate Limiting - Built-in rate limiting (configurable)
- Rust 1.91 or later
- PostgreSQL 17 or later
- Docker (optional, for development)
# Start PostgreSQL
docker-compose up -d postgres
# Run migrations and start the server
cargo run-
Set up PostgreSQL:
createdb vaultara
-
Configure environment:
cp .env.example .env # Edit .env with your configuration -
Run the application:
cargo run
-
Access the API:
- Health Check: http://localhost:8080/health
- OpenID Configuration: http://localhost:8080/.well-known/openid-configuration
- API Base: http://localhost:8080/api/v1
All configuration is done via environment variables:
| Variable | Description | Default |
|---|---|---|
SERVER_HOST |
Server bind address | 0.0.0.0 |
SERVER_PORT |
Server port | 8080 |
EXTERNAL_URL |
Public-facing URL | http://localhost:8080 |
DATABASE_URL |
PostgreSQL connection string | - |
DATABASE_MAX_CONNECTIONS |
Max DB connections | 10 |
JWT_SECRET |
Secret for JWT signing | - |
JWT_ISSUER |
JWT issuer claim | Same as EXTERNAL_URL |
ACCESS_TOKEN_LIFETIME |
Access token lifetime (seconds) | 3600 |
REFRESH_TOKEN_LIFETIME |
Refresh token lifetime (seconds) | 86400 |
GET /.well-known/openid-configuration- OpenID Connect discoveryGET /.well-known/jwks.json- JSON Web Key Set
GET /oauth/authorize- Authorization endpointPOST /oauth/token- Token endpointPOST /oauth/revoke- Token revocationPOST /oauth/introspect- Token introspectionGET /oauth/userinfo- UserInfo endpoint
GET /api/v1/tenants- List tenantsPOST /api/v1/tenants- Create tenantGET /api/v1/tenants/:id- Get tenantPUT /api/v1/tenants/:id- Update tenantDELETE /api/v1/tenants/:id- Delete tenant
GET /api/v1/tenants/:tenant_id/users- List usersPOST /api/v1/tenants/:tenant_id/users- Create userGET /api/v1/tenants/:tenant_id/users/:id- Get userPUT /api/v1/tenants/:tenant_id/users/:id- Update userDELETE /api/v1/tenants/:tenant_id/users/:id- Delete userGET /api/v1/tenants/:tenant_id/users/:id/roles- Get user rolesPOST /api/v1/tenants/:tenant_id/users/:id/roles- Assign roleDELETE /api/v1/tenants/:tenant_id/users/:id/roles/:role_id- Remove role
GET /api/v1/tenants/:tenant_id/roles- List rolesPOST /api/v1/tenants/:tenant_id/roles- Create roleGET /api/v1/tenants/:tenant_id/roles/:id- Get rolePUT /api/v1/tenants/:tenant_id/roles/:id- Update roleDELETE /api/v1/tenants/:tenant_id/roles/:id- Delete roleGET /api/v1/tenants/:tenant_id/roles/:id/permissions- Get role permissionsPOST /api/v1/tenants/:tenant_id/roles/:id/permissions- Assign permissionDELETE /api/v1/tenants/:tenant_id/roles/:id/permissions/:perm_id- Remove permission
GET /api/v1/tenants/:tenant_id/permissions- List permissionsPOST /api/v1/tenants/:tenant_id/permissions- Create permissionGET /api/v1/tenants/:tenant_id/permissions/:id- Get permissionPUT /api/v1/tenants/:tenant_id/permissions/:id- Update permissionDELETE /api/v1/tenants/:tenant_id/permissions/:id- Delete permission
GET /api/v1/tenants/:tenant_id/groups- List groupsPOST /api/v1/tenants/:tenant_id/groups- Create groupGET /api/v1/tenants/:tenant_id/groups/:id- Get groupPUT /api/v1/tenants/:tenant_id/groups/:id- Update groupDELETE /api/v1/tenants/:tenant_id/groups/:id- Delete groupGET /api/v1/tenants/:tenant_id/groups/:id/members- Get group membersGET /api/v1/tenants/:tenant_id/groups/:id/roles- Get group roles
GET /api/v1/tenants/:tenant_id/clients- List clientsPOST /api/v1/tenants/:tenant_id/clients- Create clientGET /api/v1/tenants/:tenant_id/clients/:id- Get clientPUT /api/v1/tenants/:tenant_id/clients/:id- Update clientDELETE /api/v1/tenants/:tenant_id/clients/:id- Delete clientPOST /api/v1/tenants/:tenant_id/clients/:id/secret- Regenerate secret
GET /api/v1/tenants/:tenant_id/sessions- List sessionsDELETE /api/v1/tenants/:tenant_id/sessions/:id- Revoke sessionGET /api/v1/tenants/:tenant_id/users/:user_id/sessions- Get user sessionsDELETE /api/v1/tenants/:tenant_id/users/:user_id/sessions- Revoke all user sessions
GET /api/v1/tenants/:tenant_id/audit-logs- List audit logsGET /api/v1/tenants/:tenant_id/audit-logs/:id- Get audit log entry
GET /api/v1/tenants/:tenant_id/keys- List JWT keysPOST /api/v1/tenants/:tenant_id/keys/rotate- Rotate keys
GET /setup/check- Check if setup is requiredGET /setup/status- Get installation detailsPOST /setup- Perform initial setup
GET /api/v1/tenants/:tenant_id/license- Get licensePOST /api/v1/tenants/:tenant_id/license- Create/update licenseGET /api/v1/tenants/:tenant_id/license/limits/:resource- Check limitsGET /api/v1/tenants/:tenant_id/license/features/:feature- Check featurePOST /api/v1/admin/licenses/generate- Generate license key
GET /api/v1/tenants/:tenant_id/identity-providers- List providersPOST /api/v1/tenants/:tenant_id/identity-providers- Create providerGET /api/v1/tenants/:tenant_id/identity-providers/:id- Get providerGET /api/v1/tenants/:tenant_id/identity-providers/login- Get login providersGET /api/v1/tenants/:tenant_id/identity-providers/:id/authorize- Get auth URLGET /api/v1/tenants/:tenant_id/groups/:id/login-providers- Get group providers
POST /api/v1/sessions/global- Create global sessionGET /api/v1/sessions/global/:token- Validate sessionDELETE /api/v1/sessions/global/:token- End sessionPOST /api/v1/sessions/global/:token/transfer- Create transfer tokenPOST /api/v1/sessions/transfer/redeem- Redeem transfer tokenGET /api/v1/sessions/global/me- Get my sessionsDELETE /api/v1/sessions/global/me/all- End all my sessions
POST /api/v1/mfa/totp/setup- Setup TOTPPOST /api/v1/mfa/totp/verify- Verify TOTP setupPOST /api/v1/mfa/totp/:user_id/verify- Verify TOTP codeDELETE /api/v1/mfa/totp/disable- Disable TOTPGET /api/v1/mfa/webauthn/credentials- Get WebAuthn credentialsPOST /api/v1/mfa/webauthn/register/begin- Begin registrationDELETE /api/v1/mfa/webauthn/credentials/:id- Delete credential
POST /api/v1/tenants/:tenant_id/auth/password-reset- Request resetGET /api/v1/auth/password-reset/:token/validate- Validate tokenPOST /api/v1/auth/password-reset/complete- Complete resetPOST /api/v1/tenants/:tenant_id/users/:id/verify-email- Resend verificationPOST /api/v1/auth/verify-email- Verify email
GET /api/v1/tenants/:tenant_id/policies- List policiesPOST /api/v1/tenants/:tenant_id/policies- Create policyGET /api/v1/tenants/:tenant_id/policies/:id- Get policyPOST /api/v1/tenants/:tenant_id/policies/evaluate- Evaluate policiesGET /api/v1/tenants/:tenant_id/users/:id/check-access- Quick check
┌─────────────────────────────────────────────────────────────────┐
│ Vaultara │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ API Layer │ │ Middleware │ │ Extractors │ │
│ │ (Axum) │ │ (Auth,CORS)│ │ (Auth, Pagination) │ │
│ └──────┬──────┘ └──────┬──────┘ └───────────┬─────────────┘ │
│ │ │ │ │
│ ┌──────▼────────────────▼─────────────────────▼──────────────┐ │
│ │ Domain Layer │ │
│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │
│ │ │ Entities │ │ Services │ │Repositories│ │ │
│ │ └───────────┘ └───────────┘ └───────────┘ │ │
│ └────────────────────────┬───────────────────────────────────┘ │
│ │ │
│ ┌────────────────────────▼───────────────────────────────────┐ │
│ │ Infrastructure Layer │ │
│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │
│ │ │ Database │ │ Config │ │ Security │ │ │
│ │ │ (sqlx) │ │ │ │ (JWT) │ │ │
│ │ └───────────┘ └───────────┘ └───────────┘ │ │
│ └────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
┌─────────▼─────────┐
│ PostgreSQL │
└───────────────────┘
The database schema includes:
- tenants - Multi-tenant support with branding and configuration
- users - User accounts with profile and authentication data
- roles - Role definitions with composite role support
- permissions - Fine-grained permissions with resource:action model
- groups - Hierarchical groups with path-based queries
- oauth_clients - OAuth2 client applications
- sessions - Active user sessions
- refresh_tokens - Refresh token storage with rotation detection
- authorization_codes - OAuth2 authorization codes
- jwt_keys - Key rotation support
- audit_logs - Immutable audit trail
- entity_history - Version history for all entities
vaultara/
├── Cargo.toml
├── migrations/ # Database migrations
├── src/
│ ├── api/ # HTTP handlers and routing
│ │ ├── handlers/ # Request handlers
│ │ ├── extractors/ # Request extractors
│ │ └── middleware/ # HTTP middleware
│ ├── domain/ # Business logic
│ │ ├── entities/ # Domain entities
│ │ ├── services/ # Domain services
│ │ └── repositories/ # Repository interfaces
│ ├── dto/ # Data transfer objects
│ │ ├── request/ # Request DTOs
│ │ └── response/ # Response DTOs
│ ├── infrastructure/ # External services
│ │ ├── config/ # Configuration
│ │ ├── database/ # Database layer
│ │ └── security/ # Security utilities
│ ├── lib.rs
│ └── main.rs
└── docs/ # Documentation
cargo testcargo build --release- Basic OAuth2/OIDC implementation
- Multi-tenant support
- User, Role, Permission, Group management
- OAuth client management
- Session management
- Audit logging
- JWT key rotation infrastructure
- License system for tenants (n8n-style open-source model)
- Identity Provider federation (OAuth, OIDC, SAML)
- WebAuthn/Passkeys support
- TOTP MFA with backup codes
- Email verification flow
- Password reset flow
- Cross-domain session sharing
- First-time setup wizard API
- Advanced ABAC policy engine (Rego-like)
- Group-based login restrictions
- Admin UI API endpoints
- Admin UI frontend (planned)
- Import/Export functionality
- Kubernetes operator
- High availability documentation
- Performance benchmarks
- Compliance certifications
- Enterprise support
Vaultara includes a flexible license system similar to n8n's open-source model:
- Free Tier: 10 users, 5 groups, 3 OAuth clients
- Starter Tier: 50 users, 20 groups, 10 clients, MFA support
- Professional Tier: 500 users, SSO, WebAuthn, custom branding
- Enterprise Tier: Unlimited, all features including SAML
- Founder Tier: Unlimited, with special bypass access
Sessions can be shared across different domains using Vaultara's centralized session service:
POST /api/v1/sessions/global # Create global session
GET /api/v1/sessions/global/:token # Validate session
POST /api/v1/sessions/global/:token/transfer # Create transfer token
POST /api/v1/sessions/transfer/redeem # Redeem transfer on new domain
Support for external identity providers with group-based restrictions:
GET /api/v1/tenants/:id/identity-providers # List providers
POST /api/v1/tenants/:id/identity-providers # Create provider
GET /api/v1/tenants/:id/groups/:id/login-providers # Get allowed providers for group
Instead of automatic tenant creation, the setup flow is handled via API:
GET /setup/check # Check if setup is required
GET /setup/status # Get installation status
POST /setup # Perform initial setup with tenant, admin user, and license
Advanced attribute-based access control with Rego-like conditions:
{
"name": "manager-access",
"effect": "allow",
"resource_pattern": "users:*",
"actions": ["read", "update"],
"conditions": {
"subject.role": {"in": ["admin", "manager"]},
"context.time": {"between": ["09:00", "17:00"]},
"context.ip": {"in_cidr": ["10.0.0.0/8"]}
}
}Contributions are welcome! Please read our contributing guidelines before submitting a pull request.
This project is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.