Class LdapClient

java.lang.Object
pro.taskana.common.rest.ldap.LdapClient

@Component public class LdapClient extends Object
Class for Ldap access.
  • Constructor Details

    • LdapClient

      @Autowired public LdapClient(org.springframework.core.env.Environment env, org.springframework.ldap.core.LdapTemplate ldapTemplate, pro.taskana.TaskanaConfiguration taskanaConfiguration)
  • Method Details

    • searchUsersAndGroupsAndPermissions

      public List<AccessIdRepresentationModel> searchUsersAndGroupsAndPermissions(String name) throws pro.taskana.common.api.exceptions.InvalidArgumentException, InvalidNameException
      Search LDAP for matching users or groups or permissions.
      Parameters:
      name - lookup string for names or groups or permissions
      Returns:
      a list of AccessIdResources sorted by AccessId and limited to maxNumberOfReturnedAccessIds
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException - if input is shorter than minSearchForLength
      InvalidNameException - thrown if name is not a valid dn
    • searchUsersByNameOrAccessIdInUserRole

      public List<AccessIdRepresentationModel> searchUsersByNameOrAccessIdInUserRole(String nameOrAccessId) throws pro.taskana.common.api.exceptions.InvalidArgumentException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
    • searchUsersInUserRole

      public List<pro.taskana.user.api.models.User> searchUsersInUserRole()
    • searchUsersByNameOrAccessId

      public List<AccessIdRepresentationModel> searchUsersByNameOrAccessId(String name) throws pro.taskana.common.api.exceptions.InvalidArgumentException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
    • getUsersByAccessId

      public List<AccessIdRepresentationModel> getUsersByAccessId(String accessId)
    • searchGroupsByName

      public List<AccessIdRepresentationModel> searchGroupsByName(String name) throws pro.taskana.common.api.exceptions.InvalidArgumentException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
    • searchAccessIdForGroupsAndPermissionsByDn

      public Map<String,List<String>> searchAccessIdForGroupsAndPermissionsByDn(List<String> dns) throws InvalidNameException
      Throws:
      InvalidNameException
    • searchPermissionsByName

      public List<AccessIdRepresentationModel> searchPermissionsByName(String name) throws pro.taskana.common.api.exceptions.InvalidArgumentException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
    • searchAccessIdByDn

      public AccessIdRepresentationModel searchAccessIdByDn(String dn) throws InvalidNameException
      Throws:
      InvalidNameException
    • searchGroupsAccessIdIsMemberOf

      public List<AccessIdRepresentationModel> searchGroupsAccessIdIsMemberOf(String accessId) throws pro.taskana.common.api.exceptions.InvalidArgumentException, InvalidNameException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
      InvalidNameException
    • searchPermissionsAccessIdHas

      public List<AccessIdRepresentationModel> searchPermissionsAccessIdHas(String accessId) throws pro.taskana.common.api.exceptions.InvalidArgumentException, InvalidNameException
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException
      InvalidNameException
    • searchDnForAccessId

      public String searchDnForAccessId(String accessId) throws pro.taskana.common.api.exceptions.InvalidArgumentException, InvalidNameException
      Performs a lookup to retrieve correct DN for the given access id.
      Parameters:
      accessId - The access id to lookup
      Returns:
      the LDAP Distinguished Name for the access id
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException - thrown if the given access id is ambiguous.
      InvalidNameException - thrown if name is not a valid dn
    • validateAccessId

      public boolean validateAccessId(String name) throws InvalidNameException
      Validates a given AccessId / name.
      Parameters:
      name - lookup string for names or groups
      Returns:
      whether the given name is valid or not
      Throws:
      InvalidNameException - thrown if name is not a valid dn
    • getUserSearchBase

      public String getUserSearchBase()
    • getUserSearchFilterName

      public String getUserSearchFilterName()
    • getUserSearchFilterValue

      public String getUserSearchFilterValue()
    • getUserFirstnameAttribute

      public String getUserFirstnameAttribute()
    • getUserLastnameAttribute

      public String getUserLastnameAttribute()
    • getUserPhoneAttribute

      public String getUserPhoneAttribute()
    • getUserMobilePhoneAttribute

      public String getUserMobilePhoneAttribute()
    • getUserEmailAttribute

      public String getUserEmailAttribute()
    • getUserOrgLevel1Attribute

      public String getUserOrgLevel1Attribute()
    • getUserOrgLevel2Attribute

      public String getUserOrgLevel2Attribute()
    • getUserOrgLevel3Attribute

      public String getUserOrgLevel3Attribute()
    • getUserOrgLevel4Attribute

      public String getUserOrgLevel4Attribute()
    • getUserIdAttribute

      public String getUserIdAttribute()
    • getUserMemberOfGroupAttribute

      public String getUserMemberOfGroupAttribute()
    • getUserPermissionsAttribute

      public String getUserPermissionsAttribute()
    • getPermissionSearchBase

      public String getPermissionSearchBase()
    • getPermissionSearchFilterName

      public String getPermissionSearchFilterName()
    • getPermissionSearchFilterValue

      public String getPermissionSearchFilterValue()
    • getPermissionNameAttribute

      public String getPermissionNameAttribute()
    • getGroupSearchBase

      public String getGroupSearchBase()
    • getBaseDn

      public String getBaseDn()
    • getGroupSearchFilterName

      public String getGroupSearchFilterName()
    • getGroupSearchFilterValue

      public String getGroupSearchFilterValue()
    • getGroupNameAttribute

      public String getGroupNameAttribute()
    • calcMinSearchForLength

      public int calcMinSearchForLength(int defaultValue)
    • getMinSearchForLength

      public int getMinSearchForLength()
    • calcMaxNumberOfReturnedAccessIds

      public int calcMaxNumberOfReturnedAccessIds(int defaultValue)
    • useDnForGroups

      public boolean useDnForGroups()
    • getMaxNumberOfReturnedAccessIds

      public int getMaxNumberOfReturnedAccessIds()
    • getGroupsOfUserName

      public String getGroupsOfUserName()
    • getGroupsOfUserType

      public String getGroupsOfUserType()
    • getPermissionsOfUserName

      public String getPermissionsOfUserName()
    • getPermissionsOfUserType

      public String getPermissionsOfUserType()
    • isUser

      public boolean isUser(String accessId)