java.lang.Object
com.atlassian.crowd.directory.ldap.mapper.attribute.SIDUtils

public class SIDUtils extends Object
Convert back and forth between the binary and the String representation of SIDs.
Since:
v2.7
  • Constructor Details

    • SIDUtils

      public SIDUtils()
  • Method Details

    • getPrimaryGroupSidOfUser

      public static Optional<String> getPrimaryGroupSidOfUser(LDAPUserWithAttributes user)
      In AD, users have a primaryGroupId attribute that contains the RID (relative identifier) of their primary group. The SID of the primary group is obtained by resolving the RID with respect to the SID of the user.
      Parameters:
      user - the use whose primary group's SID will be resolved
      Returns:
      an Optional containing the String representation of the user's primary group SID if present
    • substituteLastRidInSid

      public static String substituteLastRidInSid(String baseSid, String rid)
      Replaces the last subauthority of a SID with a new RID.
      Parameters:
      baseSid - a SID in its String format (i.e., not a binary SID)
      rid - a RID
      Returns:
      a SID that has the last subauthority replaced with the new RID.
    • getLastRidFromSid

      public static String getLastRidFromSid(String sid)
      Parameters:
      sid - a SID in its String format (i.e, not a binary SID)
      Returns:
      the RID of the last subauthority of the SID