Ñò
ô†³Kc @ sà d Z d g Z d d k Z d d k Z d d k Z d d k Z d d k l Z d „ Z d d k l
Z
d d k l Z d d k
l Z d e f d „ ƒ YZ e Z d
e e e e e d „ Z d S( sÈ
OpenID Authentication (Consumer)
OpenID is a distributed authentication system for single sign-on originally
developed at/for LiveJournal.com.
http://openid.net/
URL. You can have multiple identities in the same way you can have multiple
URLs. All OpenID does is provide a way to prove that you own a URL (identity).
And it does this without passing around your password, your email address, or
anything you don't want it to. There's no profile exchange component at all:
your profiile is your identity URL, but recipients of your identity can then
learn more about you from any public, semantically interesting documents
linked thereunder (FOAF, RSS, Atom, vCARD, etc.).
``Note``: paste.auth.openid requires installation of the Python-OpenID
libraries::
http://www.openidenabled.com/
This module is based highly off the consumer.py that Python OpenID comes with.
Using the OpenID Middleware
===========================
Using the OpenID middleware is fairly easy, the most minimal example using the
basic login form thats included::
# Add to your wsgi app creation
from paste.auth import open_id
wsgi_app = open_id.middleware(wsgi_app, '/somewhere/to/store/openid/data')
You will now have the OpenID form available at /oid on your site. Logging in will
verify that the login worked.
A more complete login should involve having the OpenID middleware load your own
login page after verifying the OpenID URL so that you can retain the login
information in your webapp (session, cookies, etc.)::
wsgi_app = open_id.middleware(wsgi_app, '/somewhere/to/store/openid/data',
login_redirect='/your/login/code')
Your login code should then be configured to retrieve 'paste.auth.open_id' for
the users OpenID URL. If this key does not exist, the user has not logged in.
Once the login is retrieved, it should be saved in your webapp, and the user
should be redirected to wherever they would normally go after a successful
login.
t AuthOpenIDHandleriÿÿÿÿN( t httpexceptionsc C s t i | d ƒ } d | f S( Ni s "%s"( t cgit escape( t st qs( ( s6 /usr/lib/python2.6/site-packages/paste/auth/open_id.pyt quoteattrA s ( t filestore( t consumer( t
appendArgsc B sŒ e Z d Z d d e d d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d „ Z d d
d d d d
„ Z
d „ Z d „ Z RS( sq
This middleware implements OpenID Consumer behavior to authenticate a
URL against an OpenID Server.
s /oidc C s[ t i | ƒ } t i | ƒ | _ | | _ | | _ | | _ | | _ | | _ | | _
d S( s÷
Initialize the OpenID middleware
``app``
Your WSGI app to call
``data_store_path``
Directory to store crypto data in for use with OpenID servers.
``auth_prefix``
Location for authentication process/verification
``login_redirect``
Location to load after successful process of login
``catch_401``
If true, then any 401 responses will turn into open ID login
requirements.
``url_to_username``
A function called like ``url_to_username(environ, url)``, which should
return a string username. If not given, the URL will be the username.
N( R t FileOpenIDStoreR t OpenIDConsumert oidconsumert appt auth_prefixt data_store_patht login_redirectt catch_401t url_to_username( t selfR
R R R R R t store( ( s6 /usr/lib/python2.6/site-packages/paste/auth/open_id.pyt __init__U s c C sF | d i | i ƒ o t d | d | d g ƒ } t i i | d t d t ƒ| d