Catalog PyPI
Back to packageRELEASE DETAILS

1.0.0

PyPI

adaptiveauth

Advanced Adaptive Authentication Framework with Risk-Based Security

2faadaptive-authauthenticationjwtoauthrisk-basedsecurity
Published21 Feb 2026
Direct dependencies32
Transitive dependenciesNot calculated

README

Version 1.0.0 documentation

SAGAR AdaptiveAuth Framework

License: MIT Python FastAPI [Build Status] [Version]

Advanced Adaptive Authentication Framework with Risk-Based Security

Authentication that adapts to risk in real-time, protecting users while maintaining seamless experience

🚀 Overview

SAGAR AdaptiveAuth is a cutting-edge authentication framework that implements risk-based adaptive authentication. The system dynamically adjusts security requirements based on contextual signals, behavioral biometrics, and real-time risk assessment to protect against modern threats while maintaining optimal user experience.

Key Features:

  • Risk-Based Authentication - 5-level security system (0-4) adjusting dynamically
  • Multi-Factor Authentication - Support for 2FA, email, and SMS verification
  • Behavioral Biometrics - Typing patterns and mouse movement analysis
  • Real-Time Session Monitoring - Continuous verification during active sessions
  • Framework Usage Tracking - Monitor who integrates your framework
  • Anomaly Detection - Automated suspicious activity identification
  • Admin Dashboard - Comprehensive monitoring and management tools
  • Analytics & Reporting - Charts, PDF, and CSV export capabilities
  • Enterprise Ready - Production-optimized with security-first design

🏗️ Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Frontend      │    │  AdaptiveAuth   │    │    Backend      │
│   Interface     │◄──►│   Framework     │◄──►│   Services      │
│ (HTML/JS)       │    │                 │    │ (Your App)      │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                       ┌─────────────────┐
                       │  Risk Engine    │
                       │  (Real-time)    │
                       └─────────────────┘
                              │
                       ┌─────────────────┐
                       │  Analytics &    │
                       │  Monitoring     │
                       └─────────────────┘

📋 Security Levels

LevelNameDescriptionRequirements
0TRUSTEDKnown device/IP/browserMinimal authentication
1BASICStandard loginPassword only
2VERIFIEDUnknown IPPassword + Email verification
3SECUREUnknown devicePassword + 2FA
4BLOCKEDSuspicious activityAccount locked

🛠️ Tech Stack

  • Backend: Python 3.8+, FastAPI
  • Database: SQLAlchemy with SQLite/PostgreSQL support
  • Authentication: JWT with refresh tokens
  • 2FA: TOTP with QR codes
  • Frontend: HTML5, JavaScript, Chart.js
  • API: RESTful endpoints with OpenAPI documentation
  • Security: Rate limiting, input validation, OWASP compliance

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Installation

  1. Clone the repository
git clone https://github.com/yourusername/adaptiveauth.git
cd adaptiveauth
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
  1. Configure environment
cp .env.example .env
# Edit .env file with your configuration
  1. Start the server
python main.py
  1. Access the application
  • API: http://localhost:8080
  • Documentation: http://localhost:8080/docs
  • Admin Interface: http://localhost:8080/static/index.html

🔐 Admin Access

Default admin credentials:

  • Email: admin@adaptiveauth.com
  • Password: Admin@123

⚠️ SECURITY NOTICE: Change these credentials immediately after first login!

📊 Admin Dashboard Features

1. User Management

  • View all users
  • Activate/deactivate accounts
  • Manage user roles

2. System Statistics

  • User counts and activity
  • Session monitoring
  • Security metrics

3. Risk Events

  • Monitor authentication attempts
  • View security alerts
  • Track risk patterns

4. Framework Usage Analytics

  • Track who uses your framework
  • Identify integration patterns
  • Monitor usage trends

5. Anomaly Detection

  • Identify suspicious activity
  • Automatic threat detection
  • Pattern recognition

6. Data Export

  • Export users to CSV
  • Export sessions to CSV
  • Export risk events to CSV
  • Export framework usage to CSV

7. Analytics & Charts

  • User statistics visualization
  • Risk distribution charts
  • PDF report generation
  • CSV report generation

🎯 API Endpoints

Authentication

  • POST /api/v1/auth/login - User login
  • POST /api/v1/auth/register - User registration
  • POST /api/v1/auth/adaptive-login - Adaptive login with risk assessment
  • POST /api/v1/auth/refresh - Token refresh
  • POST /api/v1/auth/logout - User logout

2FA Management

  • POST /api/v1/auth/setup-2fa - Setup two-factor authentication
  • POST /api/v1/auth/verify-2fa - Verify TOTP code
  • POST /api/v1/auth/disable-2fa - Disable 2FA

User Management

  • GET /api/v1/user/profile - Get user profile
  • PUT /api/v1/user/profile - Update user profile
  • PUT /api/v1/user/change-password - Change password
  • GET /api/v1/user/sessions - Get active sessions

Admin Endpoints

  • GET /api/v1/admin/users - List users
  • GET /api/v1/admin/statistics - System statistics
  • GET /api/v1/admin/risk-events - Risk events
  • GET /api/v1/admin/anomalies - Anomaly patterns
  • GET /api/v1/admin/framework-statistics - Framework usage statistics

📈 Risk Assessment Factors

The framework evaluates multiple risk factors:

  • Device Recognition (30%) - Known devices vs new devices
  • Location Analysis (25%) - Geographic location patterns
  • Time Patterns (15%) - Login time consistency
  • Velocity Checks (15%) - Frequency of attempts
  • Behavioral Biometrics (15%) - Typing patterns, mouse movements

🧪 Testing

Run the test suite:

python -m pytest test_framework.py

🚢 Deployment

Docker Deployment

# Build and run with Docker
docker-compose up --build

# Or build standalone image
docker build -t adaptiveauth .
docker run -p 8080:8080 adaptiveauth

Production Deployment

# Use the deployment script
./scripts/deploy.sh  # Linux/macOS
# or
scripts\deploy.bat   # Windows

🔒 Security Best Practices

  • Always use HTTPS in production
  • Rotate JWT secrets regularly
  • Monitor authentication logs
  • Implement rate limiting
  • Use strong passwords
  • Enable 2FA for admin accounts
  • Regular security audits
  • Keep dependencies updated
  • Validate all inputs
  • Sanitize all outputs

🤝 Contributing

We welcome contributions! Please read our CONTRIBUTING.md for guidelines.

Development Setup

# Fork the repository
git clone https://github.com/yourusername/adaptiveauth.git
cd adaptiveauth

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
python -m pytest

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

  • Documentation: Built-in at /docs
  • Issues: Report bugs on GitHub
  • Discussions: Join our community forum
  • Contact: [your-email@example.com]

📈 Changelog

v1.0.0 - Initial Release

  • Risk-based adaptive authentication (0-4 levels)
  • Multi-factor authentication (2FA, email, SMS)
  • Behavioral biometrics (typing patterns, mouse tracking)
  • Admin dashboard with analytics
  • Framework usage tracking
  • Anomaly detection
  • PDF/CSV reporting capabilities
  • Real-time session monitoring

🙏 Acknowledgments

  • FastAPI team for the excellent framework
  • SQLAlchemy for robust ORM capabilities
  • Chart.js for beautiful visualizations
  • Open-source community for inspiration

SAGAR AdaptiveAuth Framework - Making authentication smarter and more secure, one adaptive login at a time.

⭐ Star this repository if you found it helpful! 🐛 Report an issue 💡 Request a feature

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 34

Native requirements
32 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
fastapi
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
fastapi>=0.104.0runtime
uvicorn
Environment
{
  "extras": "standard",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
uvicorn[standard]>=0.24.0runtime
sqlalchemy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
sqlalchemy>=2.0.0runtime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pydantic>=2.0.0runtime
pydantic-settings
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pydantic-settings>=2.0.0runtime
python-jose
Environment
{
  "extras": "cryptography",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
python-jose[cryptography]>=3.3.0runtime
passlib
Environment
{
  "extras": "bcrypt",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
passlib[bcrypt]>=1.7.4runtime
bcrypt
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
bcrypt>=4.1.2runtime
python-multipart
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
python-multipart>=0.0.6runtime
pyotp
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pyotp>=2.9.0runtime
qrcode
Environment
{
  "extras": "pil",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
qrcode[pil]>=7.4.2runtime
fastapi-mail
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
fastapi-mail>=1.4.1runtime
httpx
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
httpx>=0.25.0runtime
python-dateutil
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
python-dateutil>=2.8.2runtime
user-agents
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
user-agents>=2.2.0runtime
aiofiles
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
aiofiles>=23.2.1runtime
twilio
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
twilio>=8.10.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "development"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.21.0; extra == "development"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=23.0.0; extra == "development"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
flake8>=6.0.0; extra == "development"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.0.0; extra == "development"runtime
isort
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
isort>=5.10.0; extra == "development"runtime
pre-commit
Environment
{
  "extras": "",
  "marker": "extra == \"development\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pre-commit>=3.0.0; extra == "development"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "testing"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.21.0; extra == "testing"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov>=4.0.0; extra == "testing"runtime
coverage
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
coverage>=7.0.0; extra == "testing"runtime
mkdocs
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mkdocs>=1.4.0; extra == "docs"runtime
mkdocs-material
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mkdocs-material>=9.0.0; extra == "docs"runtime
mkdocstrings
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mkdocstrings>=0.20.0; extra == "docs"runtime
mkdocstrings-python
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mkdocstrings-python>=1.1.0; extra == "docs"runtime
bandit
Environment
{
  "extras": "",
  "marker": "extra == \"security\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
bandit>=1.7.0; extra == "security"runtime
safety
Environment
{
  "extras": "",
  "marker": "extra == \"security\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
safety>=2.0.0; extra == "security"runtime

Distribution files

2 collected
adaptiveauth-1.0.0-py3-none-any.whl

bdist_wheel · 65.83 KB · Python py3

Source file
adaptiveauth-1.0.0.tar.gz

sdist · 59.97 KB · Python source

Source file

Repository

PENDING
yourusername/adaptiveauth

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:05 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:afb4178f67a6e42d38ef7f3e5c2ffbfb8987acb2269fbfdaf3da7aaf9101cbf5

Other collected versions

View all collected versions →