1
|
import os
|
2
|
import json
|
3
|
|
4
|
from django.conf import global_settings
|
5
|
|
6
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
7
|
|
8
|
|
9
|
# Quick-start development settings - unsuitable for production
|
10
|
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
11
|
|
12
|
# SECURITY WARNING: keep the secret key used in production secret!
|
13
|
SECRET_KEY = 'jg@eap06#(68*jqv)j=q5we33*-5mqiku_r231++$2cdl43_bl'
|
14
|
|
15
|
# SECURITY WARNING: don't run with debug turned on in production!
|
16
|
DEBUG = True
|
17
|
|
18
|
TEMPLATE_DEBUG = True
|
19
|
|
20
|
ALLOWED_HOSTS = []
|
21
|
|
22
|
|
23
|
# Application definition
|
24
|
|
25
|
INSTALLED_APPS = (
|
26
|
'django.contrib.admin',
|
27
|
'django.contrib.auth',
|
28
|
'django.contrib.contenttypes',
|
29
|
'django.contrib.sessions',
|
30
|
'django.contrib.messages',
|
31
|
'django.contrib.staticfiles',
|
32
|
'mellon',
|
33
|
'gadjo',
|
34
|
'uauth',
|
35
|
'uauth.organization',
|
36
|
'django_tables2',
|
37
|
)
|
38
|
|
39
|
METADATA_URIS = (
|
40
|
'https://federation.renater.fr/test/renater-test-metadata.xml',
|
41
|
# 'https://federation.renater.fr/renater/idps-renater-metadata.xml',
|
42
|
# 'https://federation.renater.fr/edugain/idps-edugain-metadata.xml',
|
43
|
)
|
44
|
|
45
|
METADATAS_DIR = os.path.join(BASE_DIR, 'metadatas')
|
46
|
|
47
|
MIDDLEWARE_CLASSES = (
|
48
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
49
|
'django.middleware.common.CommonMiddleware',
|
50
|
'django.middleware.csrf.CsrfViewMiddleware',
|
51
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
52
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
53
|
'django.contrib.messages.middleware.MessageMiddleware',
|
54
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
55
|
)
|
56
|
|
57
|
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ('django.core.context_processors.request',)
|
58
|
|
59
|
ROOT_URLCONF = 'uauth.urls'
|
60
|
|
61
|
WSGI_APPLICATION = 'uauth.wsgi.application'
|
62
|
|
63
|
DATABASES = {
|
64
|
'default': {
|
65
|
'ENGINE': 'django.db.backends.sqlite3',
|
66
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
67
|
}
|
68
|
}
|
69
|
|
70
|
# Internationalization
|
71
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
72
|
|
73
|
LANGUAGE_CODE = 'en-us'
|
74
|
|
75
|
TIME_ZONE = 'UTC'
|
76
|
|
77
|
USE_I18N = True
|
78
|
|
79
|
USE_L10N = True
|
80
|
|
81
|
USE_TZ = True
|
82
|
|
83
|
|
84
|
# Static files (CSS, JavaScript, Images)
|
85
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
86
|
|
87
|
STATIC_URL = '/static/'
|
88
|
|
89
|
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
|
90
|
('gadjo.finders.XStaticFinder',)
|
91
|
|
92
|
LDAP_CONF = {
|
93
|
'url': 'ldap://localhost',
|
94
|
'bind_dn': 'cn=admin,dc=entrouvert,dc=org',
|
95
|
'options': {},
|
96
|
'bind_passwd': 'entrouvert42',
|
97
|
'dn': 'ou=radius,dc=entrouvert,dc=org',
|
98
|
}
|
99
|
|
100
|
AUTHENTICATION_BACKENDS = global_settings.AUTHENTICATION_BACKENDS + (
|
101
|
'mellon.backends.SAMLBackend',
|
102
|
)
|
103
|
|
104
|
MELLON_ATTRIBUTE_MAPPING = {
|
105
|
'email': '{attributes[mail][0]',
|
106
|
'first_name': '{attributes[gn][0]}',
|
107
|
'last_name': '{attributes[sn][0]}',
|
108
|
}
|
109
|
|
110
|
# mellon authentication params
|
111
|
MELLON_ADAPTER = ('uauth.adapters.UAuthAdapter', )
|
112
|
|
113
|
MELLON_IDENTITY_PROVIDERS = []
|
114
|
|
115
|
MELLON_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
|
116
|
MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDH8DE3TT4xUbe4
|
117
|
/lTUNYM6cONGmESMGdLQGMPI3zO8ObslD7Nc2QtvBVz3hldZM/NZ9SAtvhoGwT3u
|
118
|
bXFWWUFkxC1F0qaz3Lc3XY5u2r4f2+aWGjdUE504fNmyZpAsPBSZcAEnMhweCGi0
|
119
|
d+RveaG8VRlHQDHzBcp/8fj4Nhfferv46i7GHUmoEJSZCbjMbCCgg1AOFqBRWQ8P
|
120
|
sQlwY9nGQq0RaQOpDvoBjZOkGBzcg1XqfgvZB3AwWMXaBoupxoCBEwbLllWB6Wb2
|
121
|
FT4mng0aOFPaKJabynCvdRpD5Fc9QR9Fhmzm+O+1eJbTj8RC8wJ/g8jdRRMLJATN
|
122
|
zAJzPnS5AgMBAAECggEBAJWXZptj1aZ856Mn1zw3FYpCMCn/fzn7kDlWbhX6ufCY
|
123
|
mSbvillroxxbvOUNxIjfT7H8ryjKVRq8tqOPiv76JO1Jwj29kDB+cS6hdxIF475e
|
124
|
fzXLQ55KVpWPBCpwhmoyQY9Tt+klmtf1nrF4CphFPvd0DEe9BiI4MPxthMPhZRc0
|
125
|
oKgOY5zcSvgbX042sLT2urlnOC2BU9ylUOt2GVIWhmj5mI6L+WGEmRPz4xtZyE32
|
126
|
hesvLPheFnWpm04xASlJ7Xq8DE2NzSkGsEEekzSgq+k0ntMMxgzYbA55EvioduIG
|
127
|
NrSAMSzThWBLEmXLu7fnPIq6A60DXcX9gmiG9leoVWkCgYEA4n89AAn3UMn0t1Pd
|
128
|
qwDJIhGwPFLak09YSLlokdZWoL6Bg25z4suewc+IC/BfEGWP9c2CeIdLcDQpYtLh
|
129
|
NmDyMUcv/+VLcwfUisvJpMVXOHZT9nB3A7L+qZpf6y1BzHYVNuFOgkJB1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LMYZlfVkgUpR56Z8SwE30yzDLAGvsBoY/Qy6sUFXGJMWNquWND2ii
|
163
|
7hYPP31xfv3omkQkkg4mxGWEpeo5oIwnM/tgPmlp3y8vACwkPXXzFkAUevjoqNXS
|
164
|
k5zCDjew+ZHe4d3Tzw2LUyRiELjOzdrjTtTCUQ3BZZSlLoXHdYdO+QZUUutaQMNa
|
165
|
3hWDMk5AYC2wkdbiFaYiihbz0MQrmoIc0RBl8kfdbQnC9xwoT1wgJeUOv0v2nuDv
|
166
|
iQ==
|
167
|
-----END CERTIFICATE-----"""]
|
168
|
|
169
|
|
170
|
local_settings_file = os.environ.get('UAUTH_SETTINGS_FILE',
|
171
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
172
|
if os.path.exists(local_settings_file):
|
173
|
execfile(local_settings_file)
|