=============
django-trench
=============
.. image:: https://cybersecurity-excellence-awards.com/wp-content/uploads/2021/06/badges_2022_Silver.png
:target: https://cybersecurity-excellence-awards.com/candidates/merixstudio-django-trench-multi-factor-authentication-set/
-----
.. image:: https://github.com/merixstudio/django-trench/actions/workflows/django-package.yml/badge.svg
:target: https://github.com/merixstudio/django-trench/actions/workflows/django-package.yml
.. image:: https://codecov.io/gh/merixstudio/django-trench/branch/master/graph/badge.svg?token=U4yDiXUDkb
:target: https://codecov.io/gh/merixstudio/django-trench
.. image:: https://readthedocs.org/projects/django-trench/badge/?version=latest
:target: https://django-trench.readthedocs.io/en/latest/?badge=latest
.. image:: https://img.shields.io/pypi/v/django-trench
:target: https://pypi.org/project/django-trench/
| **django-trench** provides a set of REST API endpoints to supplement `django-rest-framework`_ with multi-factor authentication (MFA, 2FA). It supports both standard built-in authentication methods, as well as JWT (JSON Web Token).
| We deliver a couple of sample secondary authentication methods including sending OTP based code by:
* E-mail
* SMS / text
* 3rd party mobile apps
* `YubiKey`_
| Developers can easily add their own authentication backends supporting any communication channel.
| This is a fork of `django_trench`_. As this package has gone unmaintained for some time, we have decided to maintain a temporary package in order to provide support for Django 4.2 and beyond (if necessary).
.. _`django_trench`: https://github.com/pmclanahan/django-celery-email
Features
********
* Easily pluggable and compatible with `django-rest-framework`_
* Allows user to pick an additional authentication method from range of backends defined by a developer. Read more: `backends`_
* Comes out of a box with email, SMS, mobile apps and YubiKey support
Supported versions
******************
* Python 3.9, 3.10, 3.11, 3.12
* Django 3.0, 3.1, 3.2, 4.0, 4.1, 4.2
* Django REST Framework 3.10, 3.11, 3.12, 3.13, 3.14
| If you are going to use JWT authentication:
* `djangorestframework-simplejwt`_ >= 4.3.0
Quick Start
***********
1. Install the package using pip:
.. code-block:: python
pip install django-trench
or add it to your requirements file.
2. Add ``trench`` library to INSTALLED_APPS in your app settings file:
.. code-block:: python
INSTALLED_APPS = (
...,
'rest_framework',
'rest_framework.authtoken', # In case of implementing Token Based Authentication
...,
'trench',
)
3. Run migrations
| Read further in: `installation`_.
Translation
***********
Trench uses Transifex service to translate our package into other languages.
We will appreciate your help with translation.
https://www.transifex.com/merixstudio/django-trench/dashboard/
.. _backends: https://django-trench.readthedocs.io/en/latest/backends.html
.. _installation: https://django-trench.readthedocs.io/en/latest/installation.html
.. _django-rest-framework: http://www.django-rest-framework.org
.. _djoser: https://github.com/sunscrapers/djoser
.. _django-rest-framework-jwt: https://github.com/GetBlimp/django-rest-framework-jwt
.. _djangorestframework-simplejwt: https://github.com/davesque/django-rest-framework-simplejwt
.. _YubiKey: https://www.yubico.com/
Local development
*****************
1. Clone the repo.
2. Crete virtual environment named e.g. :code:`.venv`:
.. code-block:: shell
virtualenv .venv
3. Activate the virtual environment:
.. code-block:: shell
source .venv/bin/activate
4. Install dependencies:
.. code-block:: shell
pip install black mypy
pip install -r testproject/requirements.txt
5. Set environment variables:
.. code-block:: shell
export PYTHONPATH=./testproject
export DJANGO_SETTINGS_MODULE=settings
export SECRET_KEY=YOURsecretGOEShere
6. Create a symbolic link to the :code:`trench/` module inside the :code:`testproject/` directory to emulate the :code:`trench` package being installed.
.. code-block:: shell
# make sure you run this command from the root directory of this project
ln -s $(pwd)/trench/ $(pwd)/testproject/trench
7. Check whether the tests are passing:
.. code-block:: shell
pytest --cov=testproject/trench testproject/tests/
Remember - anytime you change something in the :code:`django-trench` source code you need to re-build and re-install
the package (steps 6-7) for the changes to be present during e.g. running the tests.
8. [OPTIONAL] To make the tests run faster you can try to execute them in parallel.
To do so you need to install the :code:`pytest-xdist` package and run the tests
with additional parameter of :code:`-n 8` where :code:`8` stands for the number
of threads that will be spawned for executing the tests. Depending on the machine
you're using using this tool can speed up the test execution process up to 5 times.
.. code-block:: shell
pytest -n 8 --cov=testproject/trench testproject/tests/
Raw data
{
"_id": null,
"home_page": "https://github.com/Panevo/django-trench-reboot",
"name": "django-trench-reboot",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Karlo Krakan",
"author_email": "karlo.krakan@panevo.com",
"download_url": "https://files.pythonhosted.org/packages/c0/a1/cd269d8a98836acac48c6d4b4b8a4094b51575521643ec6d188db74edfdf/django_trench_reboot-0.3.4.tar.gz",
"platform": null,
"description": "=============\ndjango-trench\n=============\n\n.. image:: https://cybersecurity-excellence-awards.com/wp-content/uploads/2021/06/badges_2022_Silver.png\n :target: https://cybersecurity-excellence-awards.com/candidates/merixstudio-django-trench-multi-factor-authentication-set/\n\n-----\n\n.. image:: https://github.com/merixstudio/django-trench/actions/workflows/django-package.yml/badge.svg\n :target: https://github.com/merixstudio/django-trench/actions/workflows/django-package.yml\n\n.. image:: https://codecov.io/gh/merixstudio/django-trench/branch/master/graph/badge.svg?token=U4yDiXUDkb\n :target: https://codecov.io/gh/merixstudio/django-trench\n\n.. image:: https://readthedocs.org/projects/django-trench/badge/?version=latest\n :target: https://django-trench.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/pypi/v/django-trench\n :target: https://pypi.org/project/django-trench/\n\n| **django-trench** provides a set of REST API endpoints to supplement `django-rest-framework`_ with multi-factor authentication (MFA, 2FA). It supports both standard built-in authentication methods, as well as JWT (JSON Web Token).\n\n| We deliver a couple of sample secondary authentication methods including sending OTP based code by:\n\n* E-mail\n* SMS / text\n* 3rd party mobile apps\n* `YubiKey`_\n\n| Developers can easily add their own authentication backends supporting any communication channel.\n\n| This is a fork of `django_trench`_. As this package has gone unmaintained for some time, we have decided to maintain a temporary package in order to provide support for Django 4.2 and beyond (if necessary).\n\n.. _`django_trench`: https://github.com/pmclanahan/django-celery-email\n\nFeatures\n********\n\n* Easily pluggable and compatible with `django-rest-framework`_\n* Allows user to pick an additional authentication method from range of backends defined by a developer. Read more: `backends`_\n* Comes out of a box with email, SMS, mobile apps and YubiKey support\n\nSupported versions\n******************\n\n* Python 3.9, 3.10, 3.11, 3.12\n* Django 3.0, 3.1, 3.2, 4.0, 4.1, 4.2\n* Django REST Framework 3.10, 3.11, 3.12, 3.13, 3.14\n\n| If you are going to use JWT authentication:\n\n* `djangorestframework-simplejwt`_ >= 4.3.0\n\nQuick Start\n***********\n\n1. Install the package using pip:\n\n.. code-block:: python\n\n pip install django-trench\n\nor add it to your requirements file.\n\n2. Add ``trench`` library to INSTALLED_APPS in your app settings file:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...,\n 'rest_framework',\n 'rest_framework.authtoken', # In case of implementing Token Based Authentication\n ...,\n 'trench',\n )\n\n3. Run migrations\n\n| Read further in: `installation`_.\n\nTranslation\n***********\n\nTrench uses Transifex service to translate our package into other languages.\n\nWe will appreciate your help with translation.\n\nhttps://www.transifex.com/merixstudio/django-trench/dashboard/\n\n.. _backends: https://django-trench.readthedocs.io/en/latest/backends.html\n.. _installation: https://django-trench.readthedocs.io/en/latest/installation.html\n.. _django-rest-framework: http://www.django-rest-framework.org\n.. _djoser: https://github.com/sunscrapers/djoser\n.. _django-rest-framework-jwt: https://github.com/GetBlimp/django-rest-framework-jwt\n.. _djangorestframework-simplejwt: https://github.com/davesque/django-rest-framework-simplejwt\n.. _YubiKey: https://www.yubico.com/\n\n\nLocal development\n*****************\n\n1. Clone the repo.\n\n2. Crete virtual environment named e.g. :code:`.venv`:\n\n .. code-block:: shell\n\n virtualenv .venv\n\n3. Activate the virtual environment:\n\n .. code-block:: shell\n\n source .venv/bin/activate\n\n4. Install dependencies:\n\n .. code-block:: shell\n\n pip install black mypy\n pip install -r testproject/requirements.txt\n\n5. Set environment variables:\n\n .. code-block:: shell\n\n export PYTHONPATH=./testproject\n export DJANGO_SETTINGS_MODULE=settings\n export SECRET_KEY=YOURsecretGOEShere\n\n6. Create a symbolic link to the :code:`trench/` module inside the :code:`testproject/` directory to emulate the :code:`trench` package being installed.\n\n .. code-block:: shell\n\n # make sure you run this command from the root directory of this project\n ln -s $(pwd)/trench/ $(pwd)/testproject/trench\n\n7. Check whether the tests are passing:\n\n .. code-block:: shell\n\n pytest --cov=testproject/trench testproject/tests/\n\nRemember - anytime you change something in the :code:`django-trench` source code you need to re-build and re-install\nthe package (steps 6-7) for the changes to be present during e.g. running the tests.\n\n8. [OPTIONAL] To make the tests run faster you can try to execute them in parallel.\n To do so you need to install the :code:`pytest-xdist` package and run the tests\n with additional parameter of :code:`-n 8` where :code:`8` stands for the number\n of threads that will be spawned for executing the tests. Depending on the machine\n you're using using this tool can speed up the test execution process up to 5 times.\n\n .. code-block:: shell\n\n pytest -n 8 --cov=testproject/trench testproject/tests/\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "REST Multi-factor authentication package for Django",
"version": "0.3.4",
"project_urls": {
"Homepage": "https://github.com/Panevo/django-trench-reboot"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f7459c706aa37579b4c7a9582836c789383411a8dfc1b8df64873e5689f72150",
"md5": "24fd6271cb3fce57a795501c1025f2cd",
"sha256": "063f8254e5baa8601e7b7b69cca1dc3283976bb23882bec0c530904b5a5a629b"
},
"downloads": -1,
"filename": "django_trench_reboot-0.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24fd6271cb3fce57a795501c1025f2cd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 40462,
"upload_time": "2025-01-17T20:23:58",
"upload_time_iso_8601": "2025-01-17T20:23:58.846252Z",
"url": "https://files.pythonhosted.org/packages/f7/45/9c706aa37579b4c7a9582836c789383411a8dfc1b8df64873e5689f72150/django_trench_reboot-0.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0a1cd269d8a98836acac48c6d4b4b8a4094b51575521643ec6d188db74edfdf",
"md5": "3cc9b9ba3ba7a6ff5249875b89abf581",
"sha256": "822cd3608740bc4c3a93e5f050f99ced14d6b6c84a02f3aeaeb9964a610b754b"
},
"downloads": -1,
"filename": "django_trench_reboot-0.3.4.tar.gz",
"has_sig": false,
"md5_digest": "3cc9b9ba3ba7a6ff5249875b89abf581",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30957,
"upload_time": "2025-01-17T20:24:01",
"upload_time_iso_8601": "2025-01-17T20:24:01.176912Z",
"url": "https://files.pythonhosted.org/packages/c0/a1/cd269d8a98836acac48c6d4b4b8a4094b51575521643ec6d188db74edfdf/django_trench_reboot-0.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 20:24:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Panevo",
"github_project": "django-trench-reboot",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "django-trench-reboot"
}