3 from forum.modules import get_modules_script_classes
4 from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext
6 class ConsumerAndContext:
7 def __init__(self, id, consumer, context):
9 self._consumer = consumer
12 self.context = context
16 return self._consumer()
19 (re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls
20 in get_modules_script_classes('authentication', AuthenticationConsumer).items()
21 if not re.search('AbstractAuthConsumer$', name)
25 (re.sub('AuthContext$', '', name).lower(), cls) for name, cls
26 in get_modules_script_classes('authentication', ConsumerTemplateContext).items()
29 AUTH_PROVIDERS = dict([
30 (name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys()