tags:

views:

67

answers:

1

I'm having some trouble understanding how repoze.who works.

I've followed a tutorial i found by searching on google and here's what i already have:

This is what i added in my middleware.py file

from repoze.who.config import make_middleware_with_config as make_who_with_config

app = make_who_with_config(app, global_conf, app_conf['who.config_file'],
                           app_conf['who.log_file'],
                           app_conf['who.log_level'])

Here's the who.ini : http://pastebin.com/w5Tba2Fp

Here's repoze_auth.py in /lib/auth/:

from paste.httpexceptions import HTTPFound
from iwant.model import User

class UserModelPlugin(object):

    def authenticate(self, environ, identity):
        try:
            username = identity['login']
            password = identity['password']
        except KeyError:
            return None

        success = User.authenticate(username, password)

        return success

    def add_metadata(self, environ, identity):
        username = identity.get('repoze.who.userid')
        user = User.get(username)

        if user is not None:
            identity['user'] = user

I've also checked the plugins in the repoze.who folder, but i failed to understand how it's supposed to be used.

I'd appreciate it if someone would push me in the right direction.

edit: Do i need to make a custom login controller to acquire the login credentials and pass it to one of the plugins?

A: 

Here is my WHIFF/who tutorial, which may help. http://whiffdoc.appspot.com/docs/W1100_1500.who

Aaron Watters