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
13 self.context = context
17 return self._consumer()
20 (re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls
21 in get_modules_script_classes('authentication', AuthenticationConsumer).items()
22 if not re.search('AbstractAuthConsumer$', name)
26 (re.sub('AuthContext$', '', name).lower(), cls) for name, cls
27 in get_modules_script_classes('authentication', ConsumerTemplateContext).items()
30 AUTH_PROVIDERS = dict([
31 (name, ConsumerAndContext(name, consumers[name], contexts.get(name, None))) for name in consumers.keys()