summaryrefslogtreecommitdiffstats
path: root/forum/authentication/base.py
blob: 08534adc9cba5594e4794d88262a024a11f41d79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class AuthenticationConsumer(object):

    def prepare_authentication_request(self, request, redirect_to):
        raise NotImplementedError()

    def process_authentication_request(self, response):
        raise NotImplementedError()

    def get_user_data(self, key):
        raise NotImplementedError()


class ConsumerTemplateContext(object):
    """
        Class that provides information about a certain authentication provider context in the signin page.

        class attributes:

        mode - one of BIGICON, SMALLICON, FORM

        human_name - the human readable name of the provider

        extra_js - some providers require us to load extra javascript on the signin page for them to work,
        this is the place to add those files in the form of a list

        extra_css - same as extra_js but for css files
    """
    mode = ''
    weight = 500
    human_name = ''
    extra_js = []
    extra_css = []
    show_to_logged_in_user = True

class InvalidAuthentication(Exception):
    def __init__(self, message):
        self.message = message