Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups not created in the django project and not assigned to the logged ldap user #363

Open
dimkoug opened this issue Jan 10, 2024 · 0 comments

Comments

@dimkoug
Copy link

dimkoug commented Jan 10, 2024

when i log in through ldap the user not assigned to the ldap groups and groups not created

my settings are

`import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType, LDAPSearchUnion,LDAPGroupQuery, ActiveDirectoryGroupType

AUTH_LDAP_ALWAYS_UPDATE_USER = True
AUTH_LDAP_GROUP_TYPE = GroupOfNamesType(name_attr='cn')
AUTH_LDAP_MIRROR_GROUPS = True
AUTH_LDAP_CONNECTION_OPTIONS = {ldap.OPT_REFERRALS: 1}

AUTH_LDAP_GLOBAL_OPTIONS = {
ldap.OPT_REFERRALS: 1
}

AUTH_LDAP_SERVER_URI = "ldap://example.com"
AUTH_LDAP_BIND_DN = "CN=name,OU=group1,OU=group2,DC=example,DC=net"
AUTH_LDAP_BIND_PASSWORD = "password"

AUTH_LDAP_USER_SEARCH = LDAPSearch(
'ou=group1,ou=group2,dc=example,dc=net',
ldap.SCOPE_SUBTREE,
'(sAMAccountName=%(user)s)',
)

AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
'ou=group1,ou=group2,dc=example,dc=net',
ldap.SCOPE_SUBTREE,
'(objectClass=groupOfNames)',
)

AUTH_LDAP_REQUIRE_GROUP = 'cn=groupname,ou=group1,DC=example,DC=net'

AUTH_LDAP_USER_ATTR_MAP = {
"username": "sAMAccountName",
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
}

AUTH_LDAP_USER_FLAGS_BY_GROUP = {
'is_active': 'cn=groupname,ou=group1,dc=example,dc=net',
'is_staff': 'cn=groupname,ou=group1,dc=example,dc=net',
'is_superuser': 'cn=groupname,ou=group1,dc=example,dc=net',
}

AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)

import logging
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant