Skip to content

Commit 56b7cbf

Browse files
committed
Return both user and operational LDAP attributes
Explicitly request both user and operation attributes for LDAP group search as the default searching does not include operational attributes. This is required to fetch the memberOf attribute when checking LDAP group membership. Fixes DSpace#9151
1 parent be8547e commit 56b7cbf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

dspace-api/src/main/java/org/dspace/authenticate/LDAPAuthentication.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ protected String getDNOfUser(String adminUser, String adminPassword, Context con
494494
try {
495495
SearchControls ctrls = new SearchControls();
496496
ctrls.setSearchScope(ldap_search_scope_value);
497+
// Fetch both user attributes '*' (eg. uid, cn) and operational attributes '+' (eg. memberOf)
498+
ctrls.setReturningAttributes(new String[] {"*", "+"});
497499

498500
String searchName;
499501
if (useTLS) {
@@ -700,13 +702,13 @@ public String getName() {
700702
/*
701703
* Add authenticated users to the group defined in dspace.cfg by
702704
* the authentication-ldap.login.groupmap.* key.
703-
*
705+
*
704706
* @param dn
705707
* The string containing distinguished name of the user
706-
*
708+
*
707709
* @param group
708710
* List of strings with LDAP dn of groups
709-
*
711+
*
710712
* @param context
711713
* DSpace context
712714
*/

0 commit comments

Comments
 (0)