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: Embeddings, more embeddings and Datasette Cloud - 17th September 2023
- Build an image search engine with llm-clip, chat with models with llm chat - 12th September 2023
- LLM now provides tools for working with embeddings - 4th September 2023
- Datasette 1.0a4 and 1.0a5, plus weeknotes - 30th August 2023
- Making Large Language Models work for you - 27th August 2023
- Datasette Cloud, Datasette 1.0a3, llm-mlc and more - 16th August 2023
- How I make annotated presentations - 6th August 2023
- Weeknotes: Plugins for LLM, sqlite-utils and Datasette - 5th August 2023
- Catching up on the weird world of LLMs - 3rd August 2023
- Run Llama 2 on your own Mac using LLM and Homebrew - 1st August 2023