mozilla-services / mozservices

INACTIVE - http://mzl.la/ghe-archive - Various utilities for Pyramid-based Mozilla applications
33 stars 17 forks source link

Add mozsvc.user module for access to auth backends #5

Closed rfk closed 12 years ago

rfk commented 12 years ago

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.