-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py.example
145 lines (125 loc) · 6.31 KB
/
settings.py.example
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import ldap3
# GLOBALS
# encoding
ldap3.set_config_parameter('DEFAULT_SERVER_ENCODING',
'UTF-8')
# some broken LDAP implementation may have different encoding
# than those expected by RFCs
# ldap3.set_config_paramenter('ADDITIONAL_ENCODINGS', ...)
# timeouts
ldap3.set_config_parameter('RESTARTABLE_TRIES', 1)
ldap3.set_config_parameter('POOLING_LOOP_TIMEOUT', 1)
ldap3.set_config_parameter('RESET_AVAILABILITY_TIMEOUT', 1)
ldap3.set_config_parameter('RESTARTABLE_SLEEPTIME', 1)
_REWRITE_DN_TO = 'dc=proxy,dc=testunical,dc=it'
DEFAULT = dict(server =
dict(host = 'ldaps://thathost.unical.it',
connect_timeout = 5,
# TLS...
),
connection =
dict(user = 'cn=thatusername,dc=unical,dc=it',
password = 'thatpassword',
read_only = True,
version = 3,
# see ldap3 client_strategies
client_strategy = ldap3.RESTARTABLE,
auto_bind = True,
pool_size = 10,
pool_keepalive = 10),
search =
dict(search_base = 'ou=people,dc=unical,dc=it',
search_filter = '(objectclass=person)',
search_scope = ldap3.SUBTREE,
# general purpose for huge resultsets
# TODO: implement paged resultset, see: examples/paged_resultset.py
# size_limit = 500,
# paged_size = 1000, # up to 500000 results
# paged_criticality = True, # check if the server supports paged results
# paged_cookie = True, # must be sent back while requesting subsequent entries
# to get all = # '*'
attributes = ['eduPersonPrincipalName',
'schacHomeOrganization',
'mail',
'uid',
'givenName',
'sn',
'eduPersonScopedAffiliation',
'schacPersonalUniqueId',
'schacPersonalUniqueCode'
]
),
encoding = 'utf-8',
rewrite_rules =
[{'package': 'multildap.attr_rewrite',
'name': 'replace',
'kwargs': {'from_str': 'unical', 'to_str': 'lacinu',}},
{'package': 'multildap.attr_rewrite',
'name': 'regexp_replace',
'kwargs': {'regexp': 'unical', 'sub': 'gnocc',}},
{'package': 'multildap.attr_rewrite',
'name': 'add_static_attribute',
'kwargs': {'name': 'eduPersonOrcid', 'value': 'ingoalla',}},
{'package': 'multildap.attr_rewrite',
'name': 'copy_attribute_value',
'kwargs': {'from_attr': 'uid',
'to_attr': 'schacPersonalUniqueID',
'suffix': '',
'prefix': 'urn:schac:personalUniqueID:IT:CF:',
}},
],
# Authentication settings
rewrite_dn_to = _REWRITE_DN_TO,
allow_authentication = True,
)
LDAPTEST = dict(server =
dict(host = 'ldap://ldap.testunical.it:389',
connect_timeout = 5,
# TLS...
),
connection =
dict(user = 'cn=idp1,ou=idp,dc=testunical,dc=it',
password = 'idp1',
read_only = True,
version = 3,
# see ldap3 client_strategies
client_strategy = ldap3.RESTARTABLE,
auto_bind = True,
pool_size = 10,
pool_keepalive = 10),
search =
dict(search_base = 'ou=people,dc=testunical,dc=it',
search_filter = '(objectclass=person)',
search_scope = ldap3.SUBTREE,
# general purpose for huge resultsets
# TODO: implement paged resultset, see: examples/paged_resultset.py
# size_limit = 500,
# paged_size = 1000, # up to 500000 results
# paged_criticality = True, # check if the server supports paged results
# paged_cookie = True, # must be sent back while requesting subsequent entries
# to get all = # '*'
attributes = ['eduPersonPrincipalName',
'schacHomeOrganization',
'mail',
'uid',
'givenName',
'sn',
'eduPersonScopedAffiliation',
'schacPersonalUniqueId',
'schacPersonalUniqueCode'
]
),
encoding = 'utf-8',
rewrite_rules =
[{'package': 'multildap.attr_rewrite',
'name': 'replace',
'kwargs': {'from_str': 'testunical', 'to_str': 'unical',}},
{'package': 'multildap.attr_rewrite',
'name': 'regexp_replace',
'kwargs': {'regexp': '', 'sub': '',}},
],
rewrite_dn_to = _REWRITE_DN_TO,
)
# put multiple connections here
LDAP_CONNECTIONS = {'DEFAULT' : DEFAULT,
'LDAPTEST' : LDAPTEST}