Skip to main content

Crate authvault

Crate authvault 

Source
Expand description

Authentication and authorization framework.

§Architecture

authvault follows hexagonal architecture:

  • Domain: Pure business logic (identity, auth, policy)
  • Application: Use cases and auth services
  • Adapters: JWT, OAuth2, storage, hashers
  • Infrastructure: Cross-cutting concerns (error handling, logging)

§Quick Start

use authvault::{Authenticator, UserId, Role};

let auth = Authenticator::new("secret_key");
let token = auth.generate_token(&UserId::new(), &[Role::new("admin")]);

Re-exports§

pub use adapters::refresh_token::InMemoryRefreshTokenStore;
pub use adapters::revocation::InMemoryRevocationStore;
pub use application::services::AuthService;
pub use domain::auth::Authenticator;
pub use domain::auth::RefreshClaims;
pub use domain::auth::TokenPair;
pub use domain::errors::AuthError;
pub use domain::pkce::CodeChallenge;
pub use domain::pkce::CodeVerifier;
pub use domain::pkce::OAuthState;
pub use domain::policy::Condition;
pub use domain::policy::Policy;
pub use domain::policy::PolicyEffect;
pub use domain::policy::PolicyEngine;
pub use domain::ports::RefreshTokenStore;
pub use domain::ports::RevocationStore;
pub use domain::session_store::InMemorySessionStore;
pub use domain::session_store::SessionStore;
pub use domain::session_store::SessionStoreError;
pub use domain::vault::EncryptedBlob;
pub use domain::vault::SecretVault;
pub use domain::vault::VaultEntry;
pub use domain::vault::VaultError;
pub use domain::vault::VaultKey;
pub use domain::Claims;
pub use domain::Permission;
pub use domain::Role;
pub use domain::Session;
pub use domain::SessionId;
pub use domain::User;
pub use domain::UserId;
pub use infrastructure::error::AuthKitError;
pub use middleware::AuthvaultMiddleware;
pub use middleware::AuthvaultMiddlewareAdapter;

Modules§

adapters
Adapters layer.
application
Application layer.
domain
Domain layer - pure authentication and authorization logic.
infrastructure
Infrastructure layer.
middleware
Middleware layer.

Constants§

VERSION
Framework version