Class AggregateDnResolver

  • All Implemented Interfaces:
    DnResolver

    public class AggregateDnResolver
    extends Object
    implements DnResolver
    Looks up a user's DN using multiple DN resolvers. Each DN resolver is invoked on a separate thread. If multiple DNs are allowed then the first one retrieved is returned.
    • Field Detail

      • logger

        protected final Logger logger
        Logger for this class.
      • allowMultipleDns

        private boolean allowMultipleDns
        Whether to throw an exception if multiple DNs are found.
    • Constructor Detail

      • AggregateDnResolver

        public AggregateDnResolver()
        Default constructor.
      • AggregateDnResolver

        public AggregateDnResolver​(Map<String,​DnResolver> resolvers)
        Creates a new aggregate dn resolver.
        Parameters:
        resolvers - dn resolvers
      • AggregateDnResolver

        public AggregateDnResolver​(Map<String,​DnResolver> resolvers,
                                   ExecutorService es)
        Creates a new aggregate dn resolver.
        Parameters:
        resolvers - dn resolvers
        es - executor service for invoking DN resolvers
    • Method Detail

      • getDnResolvers

        public Map<String,​DnResolver> getDnResolvers()
        Returns the DN resolvers to aggregate over.
        Returns:
        map of label to dn resolver
      • setDnResolvers

        public void setDnResolvers​(Map<String,​DnResolver> resolvers)
        Sets the DN resolvers to aggregate over.
        Parameters:
        resolvers - to set
      • addDnResolver

        public void addDnResolver​(String label,
                                  DnResolver resolver)
        Adds a DN resolver with the supplied label.
        Parameters:
        label - of the resolver
        resolver - DN resolver
      • getAllowMultipleDns

        public boolean getAllowMultipleDns()
        Returns whether DN resolution should fail if multiple DNs are found.
        Returns:
        whether an exception will be thrown if multiple DNs are found
      • setAllowMultipleDns

        public void setAllowMultipleDns​(boolean b)
        Sets whether DN resolution should fail if multiple DNs are found If false an exception will be thrown if resolve(User) finds that more than one DN resolver returns a DN. Otherwise, the first DN found is returned.
        Parameters:
        b - whether multiple DNs are allowed
      • createEntryResolver

        public EntryResolver createEntryResolver​(EntryResolver resolver)
        Creates an aggregate entry resolver using the labels from the DN resolver and the supplied entry resolver.
        Parameters:
        resolver - used for every label
        Returns:
        aggregate entry resolver
      • resolve

        public String resolve​(User user)
                       throws LdapException
        Description copied from interface: DnResolver
        Attempts to find the LDAP DN for the supplied user.
        Specified by:
        resolve in interface DnResolver
        Parameters:
        user - to find DN for
        Returns:
        user DN
        Throws:
        LdapException - if an LDAP error occurs