|
@@ -1,14 +1,15 @@
|
1
|
1
|
# -*- coding: utf-8 -*-
|
2
|
2
|
from tg.util import Bunch
|
3
|
3
|
|
|
4
|
+""" Backup of config.sa_auth """
|
4
|
5
|
_original_sa_auth = None
|
5
|
6
|
|
6
|
7
|
|
7
|
8
|
def _get_clean_sa_auth(config):
|
8
|
9
|
"""
|
9
|
|
- TODO COMMENT
|
10
|
|
- :param config:
|
11
|
|
- :return:
|
|
10
|
+ Return the original sa_auth parameter. Consider Original as it's content before first fill in configuration.
|
|
11
|
+ :param config: tg2 app config
|
|
12
|
+ :return: original sa_auth parameter
|
12
|
13
|
"""
|
13
|
14
|
global _original_sa_auth
|
14
|
15
|
|
|
@@ -21,13 +22,21 @@ def _get_clean_sa_auth(config):
|
21
|
22
|
|
22
|
23
|
|
23
|
24
|
class Auth:
|
|
25
|
+ """
|
|
26
|
+ Auth strategy base class
|
|
27
|
+ """
|
24
|
28
|
|
|
29
|
+ """ Auth strategy must be named: .ini config will use this name in auth_type parameter """
|
25
|
30
|
name = NotImplemented
|
26
|
31
|
|
27
|
32
|
def __init__(self, config):
|
28
|
33
|
self._config = config
|
29
|
34
|
|
30
|
35
|
def wrap_config(self):
|
|
36
|
+ """
|
|
37
|
+ Fill config with auth needed. You must overload with whild implementation.
|
|
38
|
+ :return:
|
|
39
|
+ """
|
31
|
40
|
self._config['sa_auth'] = _get_clean_sa_auth(self._config)
|
32
|
41
|
|
33
|
42
|
# override this if you would like to provide a different who plugin for
|