Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moschitta_auth-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moschitta_auth-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file moschitta_auth-0.1.1.tar.gz.

File metadata

  • Download URL: moschitta_auth-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/6.5.0-13parrot1-amd64

File hashes

Hashes for moschitta_auth-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4d2bf3374655f416d463bf8e18426064ed31dbc09905f553cef53fb9c30afb03
MD5 b3d78ac3b51bf231e4d798d94cc0eb3b
BLAKE2b-256 905015fe1bdfa52722127dbc87bdd70b485f51880f59284e8757088f5fddb0e8

See more details on using hashes here.

File details

Details for the file moschitta_auth-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: moschitta_auth-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/6.5.0-13parrot1-amd64

File hashes

Hashes for moschitta_auth-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29f0cece3b9791388f046a57983697d043e7775acb1f26d41849290c7997cc91
MD5 eeb615e9ac79d9afcf5707e598c9a3e0
BLAKE2b-256 4646cac45a6801cc6cb1f2617ec2a1f091e9d0eaffee0cab7c5e72e17554d2f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page