mozilla-services/mozservices — pull request #5 by rfk (2011-12-01 01:11:57+00:00)
Title: Add mozsvc.user module for access to auth backends

This adds a module "mozsvc.user" which provides some conveniences for using the server-core auth backends:

* user database backend loaded as a plugin from "auth" config section
* user database backend available as request.registry["auth"]
* authenticated user's data as a dict at request.user
* function mozsvc.user.authenticate() to easily auth against the configured backend

You have to explicitly include this since some apps won't want it:

def main(global_config, **settings):
...etc...
config.include("mozsvc")
config.include("mozsvc.user")
...etc...

I'm tempted to have this install a default AuthenticationPolicy and AuthorizationPolicy as well, but let's start small.