Resolve "LDAP connector"
This merge request allows to configure smasch in a way that authentication is done via LDAP.
However, due to the fact that data stored in smasch is very sensitive, LDAP authentication is supported only for users that already exist in smasch (they will not be created automatically). Moreover worker flag ldap_user
must be set to True
.
To configure ldap there are two parameters that must be added to local_settings.py
:
AUTH_LDAP_SERVER_URI = "ldap://lcsb-cdc-lums-01.uni.lu"
AUTH_LDAP_BASE_DN = "cn=users,cn=accounts,dc=uni,dc=lu"
By default LDAP connection is disabled.
Closes #380 (closed)
Merge request reports
Activity
changed milestone to %1.1.0~alpha.0
added enhancement high priority labels
unassigned @piotr.gawron
added 1 commit
- 9c8377a5 - for now allow users without worker to log in
I've never done so but could any these packages help?
- smash/web/auth/CustomModelBackend.py 0 → 100644
1 import logging 2 3 from django.contrib.auth.backends import ModelBackend 4 5 logger = logging.getLogger(__name__) 6 7 8 class CustomModelBackend(ModelBackend): 9 10 def authenticate(self, request, username=None, password=None, **kwargs): 11 # FIXME: If we want to prevent login of users without Worker this should work I guess this code is superseded by !353 (merged) so is fine
Given LDAP is enabled, if a user is disabled in LDAP, would still be able to login?
I would say he should not. And as far as I know he wouldn't be able to login. But it would be nice to have some automatic tests for that.
What if the user is disabled locally but not in LDAP?
The code below performs authentication only if localuser is: active, has a worker and ldap_user=True. Otherwise LDAP authentication is not called (return None)
def authenticate(self, request, username=None, password=None, **kwargs): count = Worker.objects.filter(user__username=username, user__is_active=True, ldap_user=True).count() if count == 1: logger.debug("Trying LDAP auth with: " + username) return super().authenticate(request, username, password, **kwargs) else: return None
Maybe you can try to set it up locally and play a bit using our lums LDAP?
try this:
To configure ldap there are two parameters that must be added to
local_settings.py
:AUTH_LDAP_SERVER_URI = "ldap://lcsb-cdc-lums-01.uni.lu" AUTH_LDAP_BASE_DN = "cn=users,cn=accounts,dc=uni,dc=lu"
and you should be connected to lums ldap (you might want to change ldap:// to ldaps:// (ssl support), I have not tested it yet
added 2 commits
added 24 commits
-
d93e0b73...a0f39369 - 22 commits from branch
master
- 081a6c70 - Merge remote-tracking branch 'origin/master' into 380-ldap-connector
- 5456608b - lint isuses
-
d93e0b73...a0f39369 - 22 commits from branch
mentioned in commit 6294953c