• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H28-Apr-2021-1,351809

src/H28-Apr-2021-3,9923,003

CHANGES.rstH A D28-Apr-202112.4 KiB422232

LICENSEH A D22-Aug-20191.3 KiB2419

MANIFEST.inH A D06-Oct-2020375 118

PKG-INFOH A D28-Apr-20217.7 KiB146118

README.rstH A D21-Aug-20205.9 KiB12598

setup.cfgH A D28-Apr-2021118 139

setup.pyH A D28-Apr-20211.2 KiB4134

README.rst

1django-otp
2==========
3
4.. image:: https://img.shields.io/pypi/v/django-otp?color=blue
5   :target: https://pypi.org/project/django-otp/
6   :alt: PyPI
7.. image:: https://img.shields.io/readthedocs/django-otp-official
8   :target: https://django-otp-official.readthedocs.io/
9   :alt: Documentation
10.. image:: https://img.shields.io/badge/github-django--otp-green
11   :target: https://github.com/django-otp/django-otp
12   :alt: Source
13
14This project makes it easy to add support for `one-time passwords
15<http://en.wikipedia.org/wiki/One-time_password>`_ (OTPs) to Django. It can be
16integrated at various levels, depending on how much customization is required.
17It integrates with ``django.contrib.auth``, although it is not a Django
18authentication backend. The primary target is developers wishing to incorporate
19OTPs into their Django projects as a form of `two-factor authentication
20<http://en.wikipedia.org/wiki/Two-factor_authentication>`_.
21
22Several simple OTP plugins are included and more are available separately. This
23package also includes an implementation of OATH `HOTP
24<http://tools.ietf.org/html/rfc4226>`_ and `TOTP
25<http://tools.ietf.org/html/rfc6238>`_ for convenience, as these are standard
26OTP algorithms used by multiple plugins.
27
28If you're looking for a higher-level or more opinionated solution, you might be
29interested in `django-two-factor-auth
30<https://github.com/Bouke/django-two-factor-auth>`_.
31
32Status
33------
34
35This project is stable and maintained, but is no longer actively used by the
36author and is not seeing much ongoing investment. Anyone interested in taking
37over aspects of the project should `contact me <https://github.com/psagers>`_.
38
39Well-formed issues and pull requests are welcome, but please see the
40Contributing section of the README first.
41
42.. end-of-doc-intro
43
44
45The Future
46----------
47
48Once upon a time, everything was usernames and passwords. Or even in the case of
49other authentication mechanisms, a user was either authenticated or not
50(anonymous in Django's terminology). Then there was two-factor authentication,
51which could simply be an implementation detail in a binary authentication state,
52but could also imply levels or degrees of authentication.
53
54These days, it's increasingly common to see sites with more nuanced
55authentication state. A site might remember who you are forever—so you're not
56anonymous—but if you try to do anything private, you have to re-authenticate.
57You may be able to choose from among all of the authentication mechanisms you
58have configured, or only from some of them. Specific mechanisms may be required
59for specific actions, such as using your U2F device to access your U2F settings.
60
61In short, the world seems to be moving beyond the assumptions that originally
62informed Django's essential authentication design. If I were still investing in
63Django generally, I would probably start a new multi-factor authentication
64project that would reflect these changes. It would incorporate the idea that a
65user may be authenticated by various combinations of mechanisms at any time and
66that different combinations may be required to satisfy diverse authorization
67requirements across the site. It would most likely try to disentangle
68authentication persistence from sessions, at least to some extent. Many sites
69would not require all of this flexibility, but it would open up possibilities
70for better experiences by not asking users for more than we require at any
71point.
72
73If anyone has a mind to take on a project like this, I'd be happy to offer
74whatever advice or lessons learned that I can.
75
76
77Development
78-----------
79
80Development dependencies are defined in the Pipfile; use `pipenv`_ to set up a
81suitable shell.
82
83The tests in tox.ini cover a representative sample of supported Python and
84Django versions, as well as running `flake8`_ and `isort`_ for linting and style
85consistency. Please run `tox` before checking in and sending a pull request.
86
87
88Contributing
89------------
90
91As mentioned above, this project is stable and mature. Issues and pull requests
92are welcome for important bugs and improvements. For non-trivial changes, it's
93often a good idea to start by opening an issue to track the need for a change
94and then optionally open a pull request with a proposed resolution. Issues and
95pull requests should also be focused on a single thing. Pull requests that
96bundle together a bunch of loosely related commits are unlikely to go anywhere.
97
98Another good rule of thumb—for any project, but especially a mature one—is to
99keep changes as simple as possible. In particular, there should be a high bar
100for adding new dependencies. Although it can't be ruled out, it seems highly
101unlikely that a new runtime dependency will ever be added. New testing
102dependencies are more likely, but only if there's no other way to address an
103important need.
104
105If there's a development tool that you'd like to use with this project, the
106first step is to try to update config files (setup.cfg or similar) to integrate
107the tool with the existing code. A bit of configuration glue for popular tools
108should always be safe. If that's not possible, we can consider modifying the
109code to be compatible with a broader range of tools (without breaking any
110existing compatibilities). Only as a last resort would a new testing or
111development tool be incorporated into the project as a dependency.
112
113It's also good to remember that writing the code is typically the least part of
114the work. This is true for software development in general, but especially a
115small stable project like this. The bulk of the work is in `understanding the
116problem <http://www.youtube.com/watch?v=f84n5oFoZBc>`_, determining the desired
117attributes of a solution, researching and evaluating alternatives, writing
118documentation, designing a testing strategy, etc. Writing the code itself tends
119to be a minor matter that emerges from that process.
120
121
122.. _pipenv: https://pipenv.readthedocs.io/en/latest/
123.. _flake8: https://pypi.org/project/flake8/
124.. _isort: https://pypi.org/project/isort/
125