]> git.openstreetmap.org Git - osqa.git/blob - forum/authentication/base.py
initial import
[osqa.git] / forum / authentication / base.py
1
2 class AuthenticationConsumer(object):
3
4     def prepare_authentication_request(self, request, redirect_to):
5         raise NotImplementedError()
6
7     def process_authentication_request(self, response):
8         raise NotImplementedError()
9
10     def get_user_data(self, key):
11         raise NotImplementedError()
12
13
14 class ConsumerTemplateContext(object):
15     """
16         Class that provides information about a certain authentication provider context in the signin page.
17
18         class attributes:
19
20         mode - one of BIGICON, SMALLICON, FORM
21
22         human_name - the human readable name of the provider
23
24         extra_js - some providers require us to load extra javascript on the signin page for them to work,
25         this is the place to add those files in the form of a list
26
27         extra_css - same as extra_js but for css files
28     """
29     mode = ''
30     weight = 500
31     human_name = ''
32     extra_js = []
33     extra_css = []
34     show_to_logged_in_user = True
35
36     @classmethod
37     def readable_key(cls, key):
38         return key.key
39
40 class InvalidAuthentication(Exception):
41     def __init__(self, message):
42         self.message = message
43         
44