diff options
author | hrcerqueira <hrcerqueira@gmail.com> | 2010-03-01 17:37:32 +0000 |
---|---|---|
committer | hrcerqueira <hrcerqueira@gmail.com> | 2010-03-01 17:37:32 +0000 |
commit | d01a3ff31d96aaedd9ce8ba38cb5d0cde53584fc (patch) | |
tree | bc5cd0632fdb2edbde77a5ea0db2be4cdeaedc59 /forum/authentication/__init__.py | |
parent | 0d29fc79deba22027187ae4627a7c38b3fdef2e4 (diff) | |
download | askbot-d01a3ff31d96aaedd9ce8ba38cb5d0cde53584fc.tar.gz askbot-d01a3ff31d96aaedd9ce8ba38cb5d0cde53584fc.tar.bz2 askbot-d01a3ff31d96aaedd9ce8ba38cb5d0cde53584fc.zip |
New auth system, see the wiki for details.
Diffstat (limited to 'forum/authentication/__init__.py')
-rwxr-xr-x | forum/authentication/__init__.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/forum/authentication/__init__.py b/forum/authentication/__init__.py new file mode 100755 index 00000000..e83ba872 --- /dev/null +++ b/forum/authentication/__init__.py @@ -0,0 +1,27 @@ +import re
+from forum.modules import get_modules_script_classes
+from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext
+
+class ConsumerAndContext():
+ def __init__(self, id, consumer, context):
+ self.id = id
+ self.consumer = consumer()
+
+ context.id = id
+ self.context = context
+
+consumers = dict([
+ (re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls
+ in get_modules_script_classes('authentication', AuthenticationConsumer).items()
+ if not re.search('AbstractAuthConsumer$', name)
+ ])
+
+contexts = dict([
+ (re.sub('AuthContext$', '', name).lower(), cls) for name, cls
+ in get_modules_script_classes('authentication', ConsumerTemplateContext).items()
+ ])
+
+AUTH_PROVIDERS = dict([
+ (name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys()
+ if name in contexts
+ ])
\ No newline at end of file |