Crate oxify_authn

Crate oxify_authn 

Source
Expand description

§OxiFY Authentication Module

Ported from OxiRS (https://github.com/cool-japan/oxirs) Original implementation: Copyright (c) OxiRS Contributors Adapted for OxiFY License: MIT OR Apache-2.0 (compatible with OxiRS)

This crate provides enterprise-grade authentication for OxiFY, including:

  • JWT token management
  • OAuth2/OIDC integration
  • SAML authentication
  • LDAP/Active Directory
  • Password hashing and validation
  • Multi-factor authentication (MFA)

§Example

use oxify_authn::*;

// Create JWT configuration
let config = JwtConfig::development();

// Create JWT manager
let jwt_manager = JwtManager::new(&config)?;

// Create a user
let user = User {
    username: "alice".to_string(),
    roles: vec!["admin".to_string()],
    email: Some("alice@example.com".to_string()),
    full_name: Some("Alice Wonderland".to_string()),
    last_login: None,
    permissions: vec![Permission::Admin],
};

// Generate JWT token
let token = jwt_manager.generate_token(&user)?;

// Validate token
let validation = jwt_manager.validate_token(&token)?;
assert_eq!(validation.user.username, "alice");

Re-exports§

pub use jwt::ClaimsBuilder;
pub use jwt::JwtManager;
pub use password::PasswordManager;
pub use password::PasswordPolicy;
pub use password::PasswordStrength;
pub use password::PolicyValidationResult;
pub use password::PolicyViolation;
pub use oauth::OAuth2Service;
pub use oauth::OAuth2State;
pub use oauth::OAuth2Token;
pub use oauth::OIDCUserInfo;
pub use types::*;

Modules§

jwt
JWT token handling and validation
oauth
OAuth2/OIDC authentication support
password
Password hashing and validation with configurable policy
types
Authentication types and data structures