Turn your Django application in to an OpenID consumer
24th April 2007
I’ve just put the finishing touches on the first releasable version of django_openidconsumer, a package that makes it easy to add OpenID consumer support to any Django application.
Full documentation can be found in the repository. The package consists of Django models that implement the persistent part of an OpenID consumer, some simple views that hook in to the python-openid library from OpenID Enabled and a piece of middleware that makes the user’s OpenID(s) directly available within a Django view.
To cut a long story short, it allows you write view functions that look like this:
def example_view(request):
if request.openid:
return HttpResponse("OpenID is %s" % escape(
str(request.openid)
))
else:
return HttpResponse("No OpenID")
The package also supports simple registration, which lets you request additional details such as an e-mail address or nickname from the user’s OpenID provider.
I plan to keep the package under active development, with the aim of using it to demonstrate best practises in implementing OpenID (hence the support for multiple OpenIDs and simple registration out of the box). Next on the list is integration with Django’s built in authentication system, including the ability to associate one or more OpenIDs with an existing user account.
Please post any feedback as a comment on this entry, and direct bug reports to Google Code.
More recent articles
- Weeknotes: more datasette-secrets, plus a mystery video project - 7th May 2024
- Weeknotes: Llama 3, AI for Data Journalism, llm-evals and datasette-secrets - 23rd April 2024
- Options for accessing Llama 3 from the terminal using LLM - 22nd April 2024
- AI for Data Journalism: demonstrating what we can do with this stuff right now - 17th April 2024
- Three major LLM releases in 24 hours (plus weeknotes) - 10th April 2024
- Building files-to-prompt entirely using Claude 3 Opus - 8th April 2024
- Running OCR against PDFs and images directly in your browser - 30th March 2024
- llm cmd undo last git commit - a new plugin for LLM - 26th March 2024
- Building and testing C extensions for SQLite with ChatGPT Code Interpreter - 23rd March 2024
- Claude and ChatGPT for ad-hoc sidequests - 22nd March 2024