mirror of
https://github.com/nicolabs/ldap-plugin.git
synced 2026-04-16 15:14:29 +02:00
Fix NPE
This commit is contained in:
parent
14607ac763
commit
34de0b5358
|
|
@ -32,6 +32,7 @@ import org.kohsuke.stapler.DataBoundConstructor;
|
|||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.Attributes;
|
||||
import javax.naming.ldap.LdapName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -61,7 +62,8 @@ public class FromUserRecordLDAPGroupMembershipStrategy extends LDAPGroupMembersh
|
|||
@Override
|
||||
public GrantedAuthority[] getGrantedAuthorities(LdapUserDetails ldapUser) {
|
||||
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
||||
Attribute attribute = ldapUser.getAttributes().get(attributeName);
|
||||
Attributes attributes = ldapUser.getAttributes();
|
||||
Attribute attribute = attributes == null ? null : attributes.get(attributeName);
|
||||
if (attribute != null) {
|
||||
try {
|
||||
for (Object value: Collections.list(attribute.getAll())) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue