Skip to main content

Moschitta Auth Documentation

The moschitta-auth package provides authentication functionality for the Moschitta Framework, enabling developers to implement user authentication and authorization in their applications.

Installation

You can install moschitta-auth via pip:

pip install moschitta-auth

Or use it with Poetry:

poetry add moschitta-auth

Usage

Authenticator Initialization

To use moschitta-auth, you need to initialize an instance of the BasicAuthenticator class with the path to the database where user information is stored.

from moschitta_auth.basic_authenticator import BasicAuthenticator

# Initialize the authenticator with the path to the database
authenticator = BasicAuthenticator(db_path='auth.db')

User Registration

You can use the register_user method of the BasicAuthenticator class to register a new user.

# Register a new user
authenticator.register_user(username='john_doe', password='password123')

User Authentication

Authenticate users using the authenticate_user method of the BasicAuthenticator class.

# Authenticate a user
authenticated = authenticator.authenticate_user(username='john_doe', password='password123')

Access Control

After authentication, you can implement access control logic based on user roles and permissions.

if authenticated:
    # Allow access to restricted resources
    ...
else:
    # Redirect to login page or deny access
    ...

API Reference

moschitta_auth.basic_authenticator.BasicAuthenticator

  • __init__(db_path: str): Initializes the authenticator with the path to the database.
  • register_user(username: str, password: str) -> None: Registers a new user with the provided username and password.
  • authenticate_user(username: str, password: str) -> bool: Authenticates a user with the provided username and password.
  • __len__() -> int: Returns the total number of registered users in the database.

Contributing

Contributions to moschitta-auth are welcome! You can contribute by opening issues for bugs or feature requests, submitting pull requests, or helping improve the documentation.

License

This project is licensed under the terms of the MIT License.

Release files for moschitta-auth 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moschitta-auth 0.1.1
File Size Uploaded
moschitta_auth-0.1.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moschitta-auth 0.1.1
File Interpreter ABI Platform
moschitta_auth-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / moschitta_auth-0.1.1.tar.gz

Download URL moschitta_auth-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4d2bf3374655f416d463bf8e18426064ed31dbc09905f553cef53fb9c30afb03
BLAKE2b-256 checksum
How to use checksums
905015fe1bdfa52722127dbc87bdd70b485f51880f59284e8757088f5fddb0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.2 Linux/6.5.0-13parrot1-amd64

Release files / moschitta_auth-0.1.1-py3-none-any.whl

Download URL moschitta_auth-0.1.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29f0cece3b9791388f046a57983697d043e7775acb1f26d41849290c7997cc91
BLAKE2b-256 checksum
How to use checksums
4646cac45a6801cc6cb1f2617ec2a1f091e9d0eaffee0cab7c5e72e17554d2f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.2 Linux/6.5.0-13parrot1-amd64

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page