Revision 2e753457
Modification des applications pour qu'elles utilisent un fichier de configuration séparé pour l'authentification (who.ini).
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@3991 b22e2e97-25c9-44ff-b637-2e5ceca36478
deployment/who.ini | ||
---|---|---|
1 |
[plugin:auth_tkt] |
|
2 |
use = repoze.who.plugins.auth_tkt:make_plugin |
|
3 |
secret = 'vigilo' |
|
4 |
|
|
5 |
[plugin:basicauth] |
|
6 |
use = repoze.who.plugins.basicauth:make_plugin |
|
7 |
realm=Vigilo |
|
8 |
|
|
9 |
[plugin:friendlyform] |
|
10 |
use = repoze.who.plugins.friendlyform:FriendlyFormPlugin |
|
11 |
login_form_url= /login |
|
12 |
login_handler_path = /login_handler |
|
13 |
logout_handler_path = /logout_handler |
|
14 |
rememberer_name = auth_tkt |
|
15 |
post_login_url = /post_login |
|
16 |
post_logout_url = /post_logout |
|
17 |
|
|
18 |
[plugin:sqlauth] |
|
19 |
use = vigilo.turbogears.repoze_plugins:auth_plugin |
|
20 |
|
|
21 |
[general] |
|
22 |
;request_classifier = repoze.who.classifiers:default_request_classifier |
|
23 |
request_classifier = vigilo.turbogears.repoze_plugins:vigilo_api_classifier |
|
24 |
challenge_decider = repoze.who.classifiers:default_challenge_decider |
|
25 |
|
|
26 |
[identifiers] |
|
27 |
plugins = |
|
28 |
friendlyform;browser |
|
29 |
basicauth;vigilo-api |
|
30 |
auth_tkt |
|
31 |
|
|
32 |
[authenticators] |
|
33 |
plugins = |
|
34 |
sqlauth |
|
35 |
|
|
36 |
[challengers] |
|
37 |
plugins = |
|
38 |
friendlyform;browser |
|
39 |
basicauth;vigilo-api |
|
40 |
|
|
41 |
[mdproviders] |
|
42 |
plugins = |
|
43 |
vigilo.turbogears.repoze_plugins:md_plugin |
|
44 |
vigilo.turbogears.repoze_plugins:md_group_plugin |
development.ini | ||
---|---|---|
4 | 4 |
# The %(here)s variable will be replaced with the parent directory of this file |
5 | 5 |
# |
6 | 6 |
# This file is for deployment specific config options -- other configuration |
7 |
# that is always required for the app is done in the config directory,
|
|
8 |
# and generally should not be modified by end users.
|
|
7 |
# that is always required for the app is done in the config directory, |
|
8 |
# and generally should not be modified by end users. |
|
9 | 9 |
|
10 | 10 |
[DEFAULT] |
11 | 11 |
debug = true |
... | ... | |
16 | 16 |
|
17 | 17 |
[server:main] |
18 | 18 |
use = egg:Paste#http |
19 |
host = 0.0.0.0
|
|
19 |
host = 0.0.0.0 |
|
20 | 20 |
port = 8085 |
21 | 21 |
|
22 | 22 |
[app:main] |
... | ... | |
96 | 96 |
# execute malicious code after an exception is raised. |
97 | 97 |
#set debug = false |
98 | 98 |
|
99 |
auth.config = %(here)s/who.ini |
|
100 |
#auth.log_file = stdout |
|
101 |
#auth.log_level = debug |
|
102 |
|
|
99 | 103 |
# Logging configuration |
100 | 104 |
# Add additional loggers, handlers, formatters here |
101 | 105 |
# Uses python's logging config file format |
vigiboard/config/app_cfg.py | ||
---|---|---|
8 | 8 |
Please note that **all the argument values are strings**. If you want to |
9 | 9 |
convert them into boolean, for example, you should use the |
10 | 10 |
:func:`paste.deploy.converters.asbool` function, as in:: |
11 |
|
|
11 |
|
|
12 | 12 |
from paste.deploy.converters import asbool |
13 | 13 |
setting = asbool(global_conf.get('the_setting')) |
14 |
|
|
14 |
|
|
15 | 15 |
""" |
16 | 16 |
|
17 | 17 |
from vigilo.turbogears import VigiloAppConfig |
... | ... | |
23 | 23 |
base_config = VigiloAppConfig('vigiboard') |
24 | 24 |
base_config.package = vigiboard |
25 | 25 |
|
26 |
# Configure the authentication backend |
|
27 |
base_config.auth_backend = 'sqlalchemy' |
|
28 |
|
|
29 |
# override this if you would like to provide a different who plugin for |
|
30 |
# managing login and logout of your application |
|
31 |
base_config.sa_auth.form_plugin = None |
|
32 |
|
|
33 |
# You may optionally define a page where you want users to be redirected to |
|
34 |
# on login: |
|
35 |
base_config.sa_auth.post_login_url = '/post_login' |
|
36 |
|
|
37 |
# You may optionally define a page where you want users to be redirected to |
|
38 |
# on logout: |
|
39 |
base_config.sa_auth.post_logout_url = '/post_logout' |
|
40 |
|
|
41 |
|
|
42 | 26 |
################################## |
43 | 27 |
# Settings specific to Vigiboard # |
44 | 28 |
################################## |
... | ... | |
78 | 62 |
('hls', 'PluginHLS'), |
79 | 63 |
('status', 'PluginStatus'), |
80 | 64 |
] |
81 |
|
vigiboard/config/middleware.py | ||
---|---|---|
8 | 8 |
from pkg_resources import resource_filename |
9 | 9 |
from paste.cascade import Cascade |
10 | 10 |
from paste.urlparser import StaticURLParser |
11 |
from repoze.who.config import make_middleware_with_config \ |
|
12 |
as make_who_with_config |
|
11 | 13 |
|
12 | 14 |
__all__ = ['make_app'] |
13 | 15 |
|
14 |
# Use base_config to setup the necessary PasteDeploy application factory.
|
|
15 |
# make_base_app will wrap the TG2 app with all the middleware it needs.
|
|
16 |
# Use base_config to setup the necessary PasteDeploy application factory. |
|
17 |
# make_base_app will wrap the TG2 app with all the middleware it needs. |
|
16 | 18 |
make_base_app = base_config.setup_tg_wsgi_app(load_environment) |
17 | 19 |
|
18 | 20 |
|
... | ... | |
20 | 22 |
""" |
21 | 23 |
Set vigiboard up with the settings found in the PasteDeploy configuration |
22 | 24 |
file used. |
23 |
|
|
25 |
|
|
24 | 26 |
This is the PasteDeploy factory for the vigiboard application. |
25 |
|
|
27 |
|
|
26 | 28 |
C{app_conf} contains all the application-specific settings (those defined |
27 | 29 |
under ``[app:main]``). |
28 |
|
|
30 |
|
|
29 | 31 |
@param global_conf: The global settings for vigiboard (those |
30 | 32 |
defined under the ``[DEFAULT]`` section). |
31 | 33 |
@type global_conf: C{dict} |
... | ... | |
48 | 50 |
'vigiboard', 'public')) |
49 | 51 |
app = Cascade([app_static, common_static, local_static, app]) |
50 | 52 |
|
53 |
app = make_who_with_config( |
|
54 |
app, global_conf, |
|
55 |
app_conf.get('auth.config', 'who.ini'), |
|
56 |
app_conf.get('auth.log_file', 'stdout'), |
|
57 |
app_conf.get('auth.log_level', 'debug'), |
|
58 |
) |
|
51 | 59 |
return app |
52 |
|
who.ini | ||
---|---|---|
1 |
[plugin:auth_tkt] |
|
2 |
use = repoze.who.plugins.auth_tkt:make_plugin |
|
3 |
secret = 'vigilo' |
|
4 |
|
|
5 |
[plugin:basicauth] |
|
6 |
use = repoze.who.plugins.basicauth:make_plugin |
|
7 |
realm=Vigilo |
|
8 |
|
|
9 |
[plugin:friendlyform] |
|
10 |
use = repoze.who.plugins.friendlyform:FriendlyFormPlugin |
|
11 |
login_form_url= /login |
|
12 |
login_handler_path = /login_handler |
|
13 |
logout_handler_path = /logout_handler |
|
14 |
rememberer_name = auth_tkt |
|
15 |
post_login_url = /post_login |
|
16 |
post_logout_url = /post_logout |
|
17 |
|
|
18 |
[plugin:sqlauth] |
|
19 |
use = vigilo.turbogears.repoze_plugins:auth_plugin |
|
20 |
|
|
21 |
[general] |
|
22 |
;request_classifier = repoze.who.classifiers:default_request_classifier |
|
23 |
request_classifier = vigilo.turbogears.repoze_plugins:vigilo_api_classifier |
|
24 |
challenge_decider = repoze.who.classifiers:default_challenge_decider |
|
25 |
|
|
26 |
[identifiers] |
|
27 |
plugins = |
|
28 |
friendlyform;browser |
|
29 |
basicauth;vigilo-api |
|
30 |
auth_tkt |
|
31 |
|
|
32 |
[authenticators] |
|
33 |
plugins = |
|
34 |
sqlauth |
|
35 |
|
|
36 |
[challengers] |
|
37 |
plugins = |
|
38 |
friendlyform;browser |
|
39 |
basicauth;vigilo-api |
|
40 |
|
|
41 |
[mdproviders] |
|
42 |
plugins = |
|
43 |
vigilo.turbogears.repoze_plugins:md_plugin |
|
44 |
vigilo.turbogears.repoze_plugins:md_group_plugin |
Also available in: Unified diff