-
Notifications
You must be signed in to change notification settings - Fork 450
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
More LDAP auth patches #1669
More LDAP auth patches #1669
Conversation
Remove code duplication by factoring out the calculation of the LDAP query attributes out of _login2() resp. _login3() into __init__().
Ask for the 'memberOf' attribute to be returned in the user query only if 'ldap_load_groups' is set to True. This fixes the issue that currently LDAP authentication can only be used on LDAP servers that know this non-standard (it's an Active Directory extension) attribute. Other LDAP servers either do not necessarily have the group memberships stored in the user object (e.g. OpenLDAP), or use different attributes for this purpose (e.g. Novell eDirectory uses 'groupMembership')
DOCUMENTATION.md
Outdated
@@ -932,14 +932,20 @@ The LDAP attribute whose value shall be used as the user name after successful a | |||
|
|||
Default: not set, i.e. the login name given is used directly. | |||
|
|||
##### ldap_load_groups | |||
#### ldap_groups_attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have 5x #, please fix also current buggy entry:
#### ldap_user_attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also extend the changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done - thanks for the cross-check
This attribute is supposed to hold the group membership information if the config option 'ldap_load_groups' is True. If not given, it defaults to 'memberOf' for Active Directory. Introducing this options allows one to use radicale's LDAP auth with groups even on LDAP servers that keep their group memberships in a different attribute than 'memberOf', e.g. Novell eDirectory which uses 'groupMembership'.
The same effect can be achieved using the option 'ldap_groups_attribute' alone, if it's default becomes unset instead of 'memberOf' Benefit: one config option less to deal with. While at it, also fix header level for 'ldap_user_attribute' in documentation.
Use helper methods from the LDAP modules to get individual elements (like in our case the RDN value) out of attributes with DN syntax in a standard compliant way instead fiddling around ourselves. If these methods fail, fall back to using the whole attribute value, which allows us to also use attributes with non-DN syntax for groups and permissions.
2c297c7
to
d6c4e64
Compare
Please add changelog entry related to changed option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
Hi,
here's another round of LDAP auth patches
They deal with issues not dealt with in the previous round:
avoid code duplication by calculating attributes to query in
__init__()
allow using LDAP authentication also to servers that do not know the
memberOf
attributeby querying it only if
ldap_load_groups
isTrue
introduce config option
ldap_groups_attribute
that allows us to configure the groups attribute nameinstead of having it being hard coded to
memberOf
get rid of
ldap_load_groups
config option. - havingldap_groups_attribute
being unsetresp. being set to a specific attribute name has the exact same effect
stop fiddling around with getting the RDN value of the groups attributes returned,
and instead use the LDAP modules' helper functions foreseen for this purpose.
In addition, this gives us a bit more flexibility with the
ldap_groups_attribute
: we can use attribute with non-DN syntax too.As radicale does not rely on on the DN syntax, but only takes the RDN value anyway, this is no limitation, but a real extension
Please consider incorporating them into mainline radicale