Hello,

The repoze.who.plugins.auth_tkt plugin accepts an optional
userid_checker argument, which is parsed by
repoze.who.utils.resolveDotted, thus it is expected to be a module
global. I propose to extend the auth_tkt plugin to also look in
environ['repoze.who.plugins'] for the userid_checker.

This way, other plugins will have the possibility to register
userid_checkers automatically (i.e. from the who.ini file using a
[plugin:userid_checker] directive), thus the userid_checker
configuration could be separated from the application code and
configured from who.ini.

Of course, it would not break backwards compatibility, as auth_tkt
would still first try to use resolveDotted. Here's my idea:

repoze/who/plugins/auth_tkt.py

62,68c62,63
<         if self.userid_checker is not None:
<             if self.userid_checker in environ['repoze.who.plugins']:
<                 checker = environ['repoze.who.plugins'][self.userid_checker]
<                 if not checker(userid):
<                     return None
<             else:
<                 return None
---
>         if self.userid_checker and not self.userid_checker(userid):
>             return None
212,215c207
<         try:
<             userid_checker = resolveDotted(userid_checker)
<         except ImportError:
<             pass
---
>         userid_checker = resolveDotted(userid_checker)

Bests,
Attila
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to