I recently released a suite of packages to support two-factor 
authentication in Django by way of one-time passwords.

The core package is django-otp <http://pypi.python.org/pypi/django-otp>, 
which defines the framework and provides all of the shared APIs. 
Integration is possible at several levels, from low-level APIs (
devices_for_user()<http://packages.python.org/django-otp/auth.html#django_otp.devices_for_user>
, 
match_token()<http://packages.python.org/django-otp/auth.html#django_otp.match_token>,
 
etc.); to an AuthenticationForm 
subclass<http://packages.python.org/django-otp/auth.html#django_otp.forms.OTPAuthenticationForm>;
 to 
a replacement for Django's login view and an OTP-enabled admin site. Other 
niceties include the 
otp_required<http://packages.python.org/django-otp/auth.html#django_otp.decorators.otp_required>
 decorator, 
an analog to login_required. This is not an authentication backend: 
although it depends on django.contrib.auth for modeling purposes, it 
operates independently of the normal authentication machinery.

A given user may have zero or more OTP devices against which we can verify 
a one-time password. The core project includes Django apps that implement 
common devices such as HOTP and TOTP (compatible with Google Authenticator, 
among others) and static passwords (typically used as backup codes). The 
former include standard features such as tolerance and drift. Separately, 
django-otp-yubikey <http://pypi.python.org/pypi/django-otp-yubikey> provides 
support for YubiKey devices (locally or remotely verified). 
django-otp-twilio <http://pypi.python.org/pypi/django-otp-twilio> provides 
support for Twilio's SMS service for delivering codes by SMS. Implementing 
support for additional mechanisms is as simple as subclassing an abstract 
model class and implementing a verification method (and optionally a 
challenge method). Raw implementations of HOTP and TOTP are provided for 
convenience along with a few other generally useful utility functions.

As a companion to these, I've also released 
django-agent-trust<http://pypi.python.org/pypi/django-agent-trust>, 
which uses Django 1.4's signed key APIs to tag user-agents that the user 
has identified as trustworthy. In other words, this implements the "This is 
a private/shared computer" option one often sees on sensitive sites. 
Features include revocation and expiration (both absolute and by 
inactivity; globally, per-user, and per-agent). 
django-otp-agents<http://pypi.python.org/pypi/django-otp-agents> is 
a project that glues together django-otp and django-agent-trust to assign 
trust to user-agents by way of two-factor authentication (one of the most 
common scenarios, it seems).

Documentation: django-otp <http://packages.python.org/django-otp/>, 
django-otp-yubikey <http://packages.python.org/django-otp-yubikey>, 
django-otp-twilio <http://packages.python.org/django-otp-twilio>, 
django-agent-trust <http://packages.python.org/django-agent-trust>, 
django-otp-agents <http://packages.python.org/django-otp-agents>
Bitbucket: django-otp <https://bitbucket.org/psagers/django-otp>, 
django-agent-trust <https://bitbucket.org/psagers/django-agent-trust>

As always, the as-is clause in the BSD license isn't kidding. It's early 
days for these yet and while everything has been carefully documented and 
unit-tested, not all of the code has had contact with the real world. 
Feedback is always welcome. The Google group 
https://groups.google.com/forum/#!forum/django-otp is available for 
discussion and questions.

Thanks,
Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Heo0jxPBsZEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to