~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/config/more_samples/ldap_2servers_wikiconfig_snippet

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
    # This is a sample configuration snippet that shows how to use the ldap auth plugin,
2
 
    # when you have multiple server with the same config, like master and slave.
3
 
    # See HelpOnAuthentication and HelpOnConfiguration for more infos.
4
 
 
5
 
    from MoinMoin.auth.ldap_login import LDAPAuth
6
 
 
7
 
    ldap_common_arguments = dict(
8
 
        bind_dn='',  # We can either use some fixed user and password for binding to LDAP.
9
 
                     # Be careful if you need a % char in those strings - as they are used as
10
 
                     # a format string, you have to write %% to get a single % in the end.
11
 
                     #bind_dn = 'binduser@example.org' # (AD)
12
 
                     #bind_dn = 'cn=admin,dc=example,dc=org' # (OpenLDAP)
13
 
                     #bind_pw = 'secret'
14
 
                     # or we can use the username and password we got from the user:
15
 
                     #bind_dn = '%(username)s@example.org' # DN we use for first bind (AD)
16
 
                     #bind_pw = '%(password)s' # password we use for first bind
17
 
                     # or we can bind anonymously (if that is supported by your directory).
18
 
                     # In any case, bind_dn and bind_pw must be defined.
19
 
        bind_pw='',
20
 
        base_dn='',  # base DN we use for searching
21
 
                     #base_dn = 'ou=SOMEUNIT,dc=example,dc=org'
22
 
        scope=2, # scope of the search we do (2 == ldap.SCOPE_SUBTREE)
23
 
        referrals=0, # LDAP REFERRALS (0 needed for AD)
24
 
        search_filter='(uid=%(username)s)',  # ldap filter used for searching:
25
 
                                             #search_filter = '(sAMAccountName=%(username)s)' # (AD)
26
 
                                             #search_filter = '(uid=%(username)s)' # (OpenLDAP)
27
 
                                             # you can also do more complex filtering like:
28
 
                                             # "(&(cn=%(username)s)(memberOf=CN=WikiUsers,OU=Groups,DC=example,DC=org))"
29
 
        # some attribute names we use to extract information from LDAP (if not None,
30
 
        # if None, the attribute won't be extracted from LDAP):
31
 
        givenname_attribute=None, # often 'givenName' - ldap attribute we get the first name from
32
 
        surname_attribute=None, # often 'sn' - ldap attribute we get the family name from
33
 
        aliasname_attribute=None, # often 'displayName' - ldap attribute we get the aliasname from
34
 
        email_attribute=None, # often 'mail' - ldap attribute we get the email address from
35
 
        email_callback=None, # callback function called to make up email address
36
 
        coding='utf-8', # coding used for ldap queries and result values
37
 
        timeout=10, # how long we wait for the ldap server [s]
38
 
        start_tls=0, # usage of Transport Layer Security 0 = No, 1 = Try, 2 = Required
39
 
        tls_cacertdir=None,
40
 
        tls_cacertfile=None,
41
 
        tls_certfile=None,
42
 
        tls_keyfile=None,
43
 
        tls_require_cert=0, # 0 == ldap.OPT_X_TLS_NEVER (needed for self-signed certs)
44
 
        bind_once=False, # set to True to only do one bind - useful if configured to bind as the user on the first attempt
45
 
        autocreate=True, # set to True to automatically create/update user profiles
46
 
        report_invalid_credentials=True, # whether to emit "invalid username or password" msg at login time or not
47
 
    )
48
 
 
49
 
    ldap_authenticator1 = LDAPAuth(
50
 
        # the values shown below are the DEFAULT values (you may remove them if you are happy with them),
51
 
        # the examples shown in the comments are typical for Active Directory (AD) or OpenLDAP.
52
 
        server_uri='ldap://localhost',  # ldap / active directory server URI
53
 
                                        # use ldaps://server:636 url for ldaps,
54
 
                                        # use  ldap://server for ldap without tls (and set start_tls to 0),
55
 
                                        # use  ldap://server for ldap with tls (and set start_tls to 1 or 2).
56
 
        name='ldap1', # use e.g. 'ldap_pdc' and 'ldap_bdc' (or 'ldap1' and 'ldap2') if you auth against 2 ldap servers
57
 
        **ldap_common_arguments           # expand the common arguments
58
 
    )
59
 
    ldap_authenticator2 = LDAPAuth(
60
 
        # the values shown below are the DEFAULT values (you may remove them if you are happy with them),
61
 
        # the examples shown in the comments are typical for Active Directory (AD) or OpenLDAP.
62
 
        server_uri='ldap://127.0.0.1',  # ldap / active directory server URI
63
 
                                        # use ldaps://server:636 url for ldaps,
64
 
                                        # use  ldap://server for ldap without tls (and set start_tls to 0),
65
 
                                        # use  ldap://server for ldap with tls (and set start_tls to 1 or 2).
66
 
        name='ldap2', # use e.g. 'ldap_pdc' and 'ldap_bdc' (or 'ldap1' and 'ldap2') if you auth against 2 ldap servers
67
 
        **ldap_common_arguments           # expand the common arguments
68
 
    )
69
 
 
70
 
    auth = [ldap_authenticator1, ldap_authenticator2 ] # this is a list, you may have multiple ldap authenticators
71
 
                                                       # as well as other authenticators
72
 
 
73
 
    cookie_lifetime = (0, 1) # no anon user sessions, 1h session lifetime for logged-in users
74
 
 
75
 
    # customize user preferences (optional, see MoinMoin/config/multiconfig for internal defaults)
76
 
    # you maybe want to use user_checkbox_remove, user_checkbox_defaults, user_form_defaults,
77
 
    # user_form_disable, user_form_remove.
78