Class ActiveDirectoryPrincipalReader
- java.lang.Object
-
- lumis.portal.principal.importprincipal.reader.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) $
-
-
Constructor Summary
Constructors Constructor Description ActiveDirectoryPrincipalReader()
-
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 aSearchResult
and stores the XML string in the givenStringBuilder
.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 givenLdapContext
and stores the XML string in the givenStringBuilder
.protected void
readUser(java.lang.StringBuilder sbUser, javax.naming.directory.SearchResult entry)
Read a user from aSearchResult
and stores the XML string in the givenStringBuilder
.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 givenLdapContext
and store the result XML string in the givenStringBuilder
.
-
-
-
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 interfaceIPrincipalReader
- 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 givenLdapContext
and store the result XML string in the givenStringBuilder
. In the default implementation, this method is called byreadUsers()
.- Parameters:
sbUser
- theStringBuilder
that stores the users XML string.context
- theLdapContext
.- 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 aSearchResult
and stores the XML string in the givenStringBuilder
. In the default implementation, this method is called from#readUsers(StringBuilder, LdapContext)
.- Parameters:
sbUser
- theStringBuilder
.entry
- theSearchResult
.- 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 givenLdapContext
and stores the XML string in the givenStringBuilder
. In the default implementation, this method is called byreadGroups()
.- Parameters:
sbGroup
- theStringBuilder
.context
- theLdapContext
.- 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 aSearchResult
and stores the XML string in the givenStringBuilder
. In the default implementation, this method is called from#readGroups(StringBuilder, LdapContext)
.- Parameters:
sbUser
- theStringBuilder
.entry
- theSearchResult
.- Throws:
javax.naming.NamingException
- Since:
- 8.2.0
-
-