|
1 | 1 | # Example config |
2 | | -from jhubauthenticators import RegexUsernameParser, JSONParser |
| 2 | +from jhubauthenticators import RegexUsernameParser |
3 | 3 | from ldap_hooks import setup_ldap_entry_hook |
4 | | -from ldap_hooks import LDAP, LDAP_SEARCH_ATTRIBUTE_QUERY, SPAWNER_SUBMIT_DATA, \ |
5 | | - INCREMENT_ATTRIBUTE |
| 4 | +from ldap_hooks import LDAP, LDAP_SEARCH_ATTRIBUTE_QUERY, \ |
| 5 | + SPAWNER_SUBMIT_DATA, INCREMENT_ATTRIBUTE |
6 | 6 | c = get_config() |
7 | 7 |
|
8 | 8 | c.JupyterHub.ip = '0.0.0.0' |
|
21 | 21 | c.HeaderAuthenticator.header_parser_classes = {'auth': RegexUsernameParser} |
22 | 22 | c.HeaderAuthenticator.user_external_allow_attributes = ['data'] |
23 | 23 | # Email regex |
24 | | -RegexUsernameParser.username_extract_regex = '([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)' |
| 24 | +RegexUsernameParser.username_extract_regex = '([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]' \ |
| 25 | + '+\.[a-zA-Z0-9-.]+)' |
25 | 26 |
|
26 | 27 |
|
27 | 28 | # Define LDAP connection options |
|
48 | 49 | 'NB_UID': '{uidNumber}'}, |
49 | 50 | } |
50 | 51 |
|
51 | | -# Attributes used to check whether the ldap data of type object_classes already exists |
| 52 | +# Attributes used to check whether the ldap data |
| 53 | +# of type object_classes already exists |
52 | 54 | # LDAP.unique_object_attributes = ['emailAddress'] |
53 | | -LDAP.search_attribute_queries = [{'search_base': LDAP.base_dn, |
54 | | - 'search_filter': '(objectclass=X-nextUserIdentifier)', |
55 | | - 'attributes': ['uidNumber']}] |
| 55 | +LDAP.search_attribute_queries = [ |
| 56 | + {'search_base': LDAP.base_dn, |
| 57 | + 'search_filter': '(objectclass=X-nextUserIdentifier)', |
| 58 | + 'attributes': ['uidNumber']} |
| 59 | +] |
56 | 60 |
|
| 61 | +modify_dn = 'cn=uidNext' + ',' + LDAP.base_dn |
57 | 62 | LDAP.search_result_operation = {'uidNumber': {'action': INCREMENT_ATTRIBUTE, |
58 | | - 'modify_dn': 'cn=uidNext' |
59 | | - + ',' + LDAP.base_dn}} |
| 63 | + 'modify_dn': modify_dn}} |
60 | 64 |
|
61 | 65 | # Submit object settings |
62 | 66 | LDAP.object_classes = ['X-certsDistinguishedName', 'PosixAccount'] |
|
0 commit comments