ldap is no more [']
This commit is contained in:
parent
5fa30b7e3a
commit
0df044b267
|
@ -6,13 +6,11 @@ git+https://github.com/d42/django-tree@687c01c02d91cada9ca1912e34e482da9e73e27a#
|
||||||
django-appconf==1.0.2
|
django-appconf==1.0.2
|
||||||
django-flat-responsive==2.0
|
django-flat-responsive==2.0
|
||||||
social-auth-app-django==2.1.0
|
social-auth-app-django==2.1.0
|
||||||
django-auth-ldap==1.2.12
|
|
||||||
Django-Select2==6.3.1
|
Django-Select2==6.3.1
|
||||||
djangorestframework==3.5.4
|
djangorestframework==3.5.4
|
||||||
Pillow==3.3.1
|
Pillow==3.3.1
|
||||||
psycopg2==2.7.5
|
psycopg2==2.7.5
|
||||||
djangorestframework-hstore==1.3
|
djangorestframework-hstore==1.3
|
||||||
pyldap==2.4.28
|
|
||||||
requests==2.16.5
|
requests==2.16.5
|
||||||
urllib3==1.21.1
|
urllib3==1.21.1
|
||||||
django_markdown2==0.3.0
|
django_markdown2==0.3.0
|
||||||
|
|
|
@ -124,20 +124,11 @@ SELECT2_JS = 'js/select2.min.js'
|
||||||
SELECT2_CSS = 'css/select2.min.css'
|
SELECT2_CSS = 'css/select2.min.css'
|
||||||
SELECT2_I18N_PATH = ''
|
SELECT2_I18N_PATH = ''
|
||||||
|
|
||||||
# LDAP configuration
|
|
||||||
|
|
||||||
import ldap
|
|
||||||
from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType, LDAPGroupQuery
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
AUTHENTICATION_BACKENDS = (
|
||||||
'django_auth_ldap.backend.LDAPBackend',
|
|
||||||
'auth.backend.HSWawOAuth2',
|
'auth.backend.HSWawOAuth2',
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
)
|
)
|
||||||
|
|
||||||
AUTH_LDAP_SERVER_URI = "ldaps://ldap.hackerspace.pl"
|
|
||||||
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,dc=hackerspace,dc=pl"
|
|
||||||
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True
|
|
||||||
SOCIAL_AUTH_PIPELINE = (
|
SOCIAL_AUTH_PIPELINE = (
|
||||||
'social_core.pipeline.social_auth.social_details',
|
'social_core.pipeline.social_auth.social_details',
|
||||||
'social_core.pipeline.social_auth.social_uid',
|
'social_core.pipeline.social_auth.social_uid',
|
||||||
|
@ -150,35 +141,6 @@ SOCIAL_AUTH_PIPELINE = (
|
||||||
'auth.pipeline.staff_me_up',
|
'auth.pipeline.staff_me_up',
|
||||||
'social_core.pipeline.social_auth.associate_by_email',)
|
'social_core.pipeline.social_auth.associate_by_email',)
|
||||||
|
|
||||||
member_ldap_query = (
|
|
||||||
LDAPGroupQuery("cn=fatty,ou=Group,dc=hackerspace,dc=pl") |
|
|
||||||
LDAPGroupQuery("cn=starving,ou=Group,dc=hackerspace,dc=pl") |
|
|
||||||
LDAPGroupQuery("cn=potato,ou=Group,dc=hackerspace,dc=pl"))
|
|
||||||
|
|
||||||
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
|
|
||||||
"is_active": member_ldap_query,
|
|
||||||
"is_superuser": member_ldap_query, # "cn=staff,ou=Group,dc=hackerspace,dc=pl",
|
|
||||||
"is_staff": member_ldap_query,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Populate the Django user from the LDAP directory.
|
|
||||||
AUTH_LDAP_USER_ATTR_MAP = {
|
|
||||||
"first_name": "givenName",
|
|
||||||
"last_name": "sn",
|
|
||||||
"email": "mail"
|
|
||||||
}
|
|
||||||
|
|
||||||
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Group,dc=hackerspace,dc=pl",
|
|
||||||
ldap.SCOPE_SUBTREE, "(objectClass=groupOfUniqueNames)"
|
|
||||||
)
|
|
||||||
AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType(name_attr="cn")
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger('django_auth_ldap')
|
|
||||||
logger.addHandler(logging.StreamHandler())
|
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue