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 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.0.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.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moschitta_auth-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 544afae4f85b72733200b4a5a520eccc0727f0cf0d78f20170d385979ed8357c
MD5 0694c57f5998d7b7108947c25fdd133d
BLAKE2b-256 30568ab34d7a00d07246ca81f40f5681d0f855a176f4221db54fe1847ae60ce7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moschitta_auth-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a85ed61056ff2546dea2e8ffc6eaf996489356c8fcdf64cfe568ca05e73645
MD5 1e59302a64520aa757197c53291cdfc2
BLAKE2b-256 af3712cfc459044f1db1edd4833b15b7ef8f5b269bc5a632c96b96eaf5edf44f

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