Class ActiveDirectoryPrincipalReader

  • All Implemented Interfaces:
    IPrincipalReader

    @StableMinor(version="16.0",
                 sinceVersion="11.0")
    public class ActiveDirectoryPrincipalReader
    extends java.lang.Object
    implements IPrincipalReader
    Implementation of IPrincipalReader for Active Directory
    Since:
    4.0.8
    Version:
    $Revision: 25809 $ $Date: 2023-07-04 15:23:22 -0300 (Tue, 04 Jul 2023) $
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String evaluateLoginExpression​(java.lang.String loginExpression, javax.naming.directory.Attributes userAttributes)
      Evaluates an expression for resolving the login to be used for an user.
      protected java.util.Collection<java.lang.String> getCustomUserAttributes()
      Returns the custom attributes to be read for each user.
      protected java.lang.String getGroupShortId​(javax.naming.directory.Attributes groupAttributes)
      Returns the shortId for the group with the given attributes.
      protected java.lang.String getUserPrimaryLogin​(javax.naming.directory.Attributes userAttributes)
      Returns the primary login for the user with the given attributes.
      java.util.Map<java.lang.String,​java.lang.String> read​(org.w3c.dom.Node reader)
      Read users and groups and return them in string format in entries named userList and groupList of the map returned.
      protected void readGroup​(java.lang.StringBuilder sbGroup, javax.naming.directory.SearchResult entry)
      Read a group from a SearchResult and stores the XML string in the given StringBuilder.
      protected java.lang.String readGroups()
      Returns a XML string containing the groups read from AD.
      protected void readGroups​(java.lang.StringBuilder sbGroup, javax.naming.ldap.LdapContext context, boolean recursive)
      Reads the groups using the given LdapContext and stores the XML string in the given StringBuilder.
      protected void readUser​(java.lang.StringBuilder sbUser, javax.naming.directory.SearchResult entry)
      Read a user from a SearchResult and stores the XML string in the given StringBuilder.
      protected java.lang.String readUsers()
      Returns a XML string containing the users read from AD.
      protected void readUsers​(java.lang.StringBuilder sbUser, javax.naming.ldap.LdapContext context, boolean recursive)
      Reads the users from ActiveDirectory using the given LdapContext and store the result XML string in the given StringBuilder.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ActiveDirectoryPrincipalReader

        public ActiveDirectoryPrincipalReader()
    • Method Detail

      • read

        public java.util.Map<java.lang.String,​java.lang.String> read​(org.w3c.dom.Node reader)
                                                                    throws PortalException
        Description copied from interface: IPrincipalReader
        Read users and groups and return them in string format in entries named userList and groupList of the map returned.
        Specified by:
        read in interface IPrincipalReader
        Returns:
        Throws:
        PortalException
      • readUsers

        protected java.lang.String readUsers()
                                      throws PortalException
        Returns a XML string containing the users read from AD.
        Returns:
        a XML string containing the users read from AD.
        Throws:
        PortalException
        Since:
        8.2.0
      • readGroups

        protected java.lang.String readGroups()
                                       throws PortalException
        Returns a XML string containing the groups read from AD.
        Returns:
        a XML string containing the groups read from AD.
        Throws:
        PortalException
        Since:
        8.2.0
      • readUsers

        protected void readUsers​(java.lang.StringBuilder sbUser,
                                 javax.naming.ldap.LdapContext context,
                                 boolean recursive)
                          throws PortalException
        Reads the users from ActiveDirectory using the given LdapContext and store the result XML string in the given StringBuilder. In the default implementation, this method is called by readUsers().
        Parameters:
        sbUser - the StringBuilder that stores the users XML string.
        context - the LdapContext.
        Throws:
        PortalException
        Since:
        8.2.0
      • readUser

        protected void readUser​(java.lang.StringBuilder sbUser,
                                javax.naming.directory.SearchResult entry)
                         throws javax.naming.NamingException
        Read a user from a SearchResult and stores the XML string in the given StringBuilder. In the default implementation, this method is called from #readUsers(StringBuilder, LdapContext).
        Parameters:
        sbUser - the StringBuilder.
        entry - the SearchResult.
        Throws:
        javax.naming.NamingException
        Since:
        8.2.0
      • getCustomUserAttributes

        protected java.util.Collection<java.lang.String> getCustomUserAttributes()
        Returns the custom attributes to be read for each user.
        Returns:
        the custom attributes to be read for each user.
        Since:
        8.2.0
      • getUserPrimaryLogin

        protected java.lang.String getUserPrimaryLogin​(javax.naming.directory.Attributes userAttributes)
                                                throws javax.naming.NamingException
        Returns the primary login for the user with the given attributes.
        Parameters:
        userAttributes - the user's attributes.
        Returns:
        the primary login or null if the user has no login available.
        Throws:
        javax.naming.NamingException
        Since:
        4.0.11
      • evaluateLoginExpression

        protected java.lang.String evaluateLoginExpression​(java.lang.String loginExpression,
                                                           javax.naming.directory.Attributes userAttributes)
        Evaluates an expression for resolving the login to be used for an user.
        Parameters:
        loginExpression - the login expression.
        userAttributes - the user's attributes.
        Returns:
        the evaluated result.
        Since:
        11.0.0
      • getGroupShortId

        protected java.lang.String getGroupShortId​(javax.naming.directory.Attributes groupAttributes)
                                            throws javax.naming.NamingException
        Returns the shortId for the group with the given attributes.
        Parameters:
        groupAttributes - the group's attributes.
        Returns:
        the short id for the group.
        Throws:
        javax.naming.NamingException
        Since:
        11.0.0
      • readGroups

        protected void readGroups​(java.lang.StringBuilder sbGroup,
                                  javax.naming.ldap.LdapContext context,
                                  boolean recursive)
                           throws PortalException
        Reads the groups using the given LdapContext and stores the XML string in the given StringBuilder. In the default implementation, this method is called by readGroups().
        Parameters:
        sbGroup - the StringBuilder.
        context - the LdapContext.
        Throws:
        PortalException
        Since:
        8.2.0
      • readGroup

        protected void readGroup​(java.lang.StringBuilder sbGroup,
                                 javax.naming.directory.SearchResult entry)
                          throws javax.naming.NamingException
        Read a group from a SearchResult and stores the XML string in the given StringBuilder. In the default implementation, this method is called from #readGroups(StringBuilder, LdapContext).
        Parameters:
        sbUser - the StringBuilder.
        entry - the SearchResult.
        Throws:
        javax.naming.NamingException
        Since:
        8.2.0