mirror of
https://github.com/nicolabs/ldap-plugin.git
synced 2026-05-21 11:58:41 +02:00
fix 2nd NPE
This commit is contained in:
parent
2d1ac33283
commit
7089a11e5f
|
|
@ -27,6 +27,7 @@ import hudson.Extension;
|
|||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.userdetails.ldap.LdapUserDetails;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.kohsuke.stapler.DataBoundConstructor;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
|
|
@ -56,13 +57,14 @@ public class FromUserRecordLDAPGroupMembershipStrategy extends LDAPGroupMembersh
|
|||
}
|
||||
|
||||
public String getAttributeName() {
|
||||
return attributeName;
|
||||
return StringUtils.defaultIfEmpty(attributeName, "memberOf");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GrantedAuthority[] getGrantedAuthorities(LdapUserDetails ldapUser) {
|
||||
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
||||
Attributes attributes = ldapUser.getAttributes();
|
||||
final String attributeName = getAttributeName();
|
||||
Attribute attribute = attributes == null ? null : attributes.get(attributeName);
|
||||
if (attribute != null) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue