Skip to main content

Overview

Enferno provides a robust authentication system built on Flask-Security-Too with modern security features and OAuth integration.

Features

  • User registration and login
  • Role-based access control (RBAC)
  • Two-factor authentication (2FA)
  • WebAuthn / Passkeys
  • OAuth integration (Google, GitHub)
  • Password policies
  • Session protection
  • CSRF protection

OAuth Integration

Enable social login with Google and GitHub:
Scopes:
  • Google: profile and email
  • GitHub: user:email

User Management

Registration

Role-Based Access

API Authentication

Token-Based Auth

Generate Auth Token

Security Configuration

Key security settings in .env:

Two-Factor Authentication

Enable 2FA for enhanced security:

WebAuthn Support

Enable WebAuthn for passwordless authentication:

Session Protection

Enferno includes several session security measures:

Rate Limiting (Optional)

Add rate limiting with flask-limiter:

Best Practices

  1. Password Storage
    • Passwords are automatically hashed using secure algorithms
    • Salt is unique per user
    • Configurable password policies
  2. CSRF Protection
    • Automatic CSRF token generation
    • Required for all POST/PUT/DELETE requests
    • Configurable token lifetime
  3. XSS Prevention
    • Content Security Policy headers
    • Automatic HTML escaping in templates
    • Secure cookie flags
  4. Security Headers
    • HSTS enabled
    • X-Frame-Options set
    • X-Content-Type-Options: nosniff
    • Referrer-Policy configured

Troubleshooting

Common issues and solutions:
  1. Token Expiration
    • Check SECURITY_TOKEN_MAX_AGE setting
    • Verify system time synchronization
    • Clear expired tokens regularly
  2. OAuth Issues
    • Verify callback URLs in provider settings
    • Check scope permissions
    • Ensure secrets are correctly configured
  3. 2FA Problems
    • Verify TOTP secrets configuration
    • Check time synchronization
    • Provide backup codes for recovery