Module jcifs

Interface SID

All Known Implementing Classes:
SID

public interface SID
A Windows SID is a numeric identifier used to represent Windows accounts. SIDs are commonly represented using a textual format such as S-1-5-21-1496946806-2192648263-3843101252-1029 but they may also be resolved to yield the name of the associated Windows account such as Administrators or MYDOM\alice.

Consider the following output of examples/SidLookup.java:

        toString: S-1-5-21-4133388617-793952518-2001621813-512
 toDisplayString: WNET\Domain Admins
         getType: 2
     getTypeText: Domain group
   getDomainName: WNET
  getAccountName: Domain Admins
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    SID type indicating a local group or alias.
    static final int
    SID type indicating a deleted account.
    static final int
    SID type indicating a domain group.
    static final int
    SID type indicating a domain.
    static final int
    SID type indicating an invalid SID.
    static final int
    SID type indicating an unknown account type.
    static final int
    SID type indicating no type information.
    static final int
    SID type indicating a user account.
    static final int
    SID type indicating a well-known group.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the sAMAccountName of this SID unless it could not be resolved in which case the numeric RID is returned.
    Return the domain name of this SID unless it could not be resolved in which case the numeric representation is returned.
    Gets the domain SID for this SID.
    int
    Get the RID This is the last subauthority identifier
    int
    Returns the type of this SID indicating the state or type of account.
    Return text representing the SID type suitable for display to users.
    Return a String representing this SID ideal for display to users.
    <T> T
    unwrap(Class<T> type)
    Unwraps this SID to the specified type.
  • Field Details

    • SID_TYPE_USE_NONE

      static final int SID_TYPE_USE_NONE
      SID type indicating no type information.
      See Also:
    • SID_TYPE_USER

      static final int SID_TYPE_USER
      SID type indicating a user account.
      See Also:
    • SID_TYPE_DOM_GRP

      static final int SID_TYPE_DOM_GRP
      SID type indicating a domain group.
      See Also:
    • SID_TYPE_DOMAIN

      static final int SID_TYPE_DOMAIN
      SID type indicating a domain.
      See Also:
    • SID_TYPE_ALIAS

      static final int SID_TYPE_ALIAS
      SID type indicating a local group or alias.
      See Also:
    • SID_TYPE_WKN_GRP

      static final int SID_TYPE_WKN_GRP
      SID type indicating a well-known group.
      See Also:
    • SID_TYPE_DELETED

      static final int SID_TYPE_DELETED
      SID type indicating a deleted account.
      See Also:
    • SID_TYPE_INVALID

      static final int SID_TYPE_INVALID
      SID type indicating an invalid SID.
      See Also:
    • SID_TYPE_UNKNOWN

      static final int SID_TYPE_UNKNOWN
      SID type indicating an unknown account type.
      See Also:
  • Method Details

    • getDomainSid

      SID getDomainSid()
      Gets the domain SID for this SID.
      Returns:
      domain SID
    • getRid

      int getRid()
      Get the RID This is the last subauthority identifier
      Returns:
      the RID
    • toDisplayString

      String toDisplayString()
      Return a String representing this SID ideal for display to users. This method should return the same text that the ACL editor in Windows would display.

      Specifically, if the SID has been resolved and it is not a domain SID or builtin account, the full DOMAIN\name form of the account will be returned (e.g. MYDOM\alice or MYDOM\Domain Users). If the SID has been resolved but it is is a domain SID, only the domain name will be returned (e.g. MYDOM). If the SID has been resolved but it is a builtin account, only the name component will be returned (e.g. SYSTEM). If the sid cannot be resolved the numeric representation from toString() is returned.

      Returns:
      display format, potentially with resolved names
    • getAccountName

      String getAccountName()
      Return the sAMAccountName of this SID unless it could not be resolved in which case the numeric RID is returned. If this SID is a domain SID, this method will return an empty String.
      Returns:
      the account name
    • getDomainName

      String getDomainName()
      Return the domain name of this SID unless it could not be resolved in which case the numeric representation is returned.
      Returns:
      the domain name
    • getTypeText

      String getTypeText()
      Return text representing the SID type suitable for display to users. Text includes 'User', 'Domain group', 'Local group', etc.
      Returns:
      textual representation of type
    • getType

      int getType()
      Returns the type of this SID indicating the state or type of account.

      SID types are described in the following table.

      Type codes
      Type Name
      SID_TYPE_USE_NONE 0
      SID_TYPE_USER User
      SID_TYPE_DOM_GRP Domain group
      SID_TYPE_DOMAIN Domain
      SID_TYPE_ALIAS Local group
      SID_TYPE_WKN_GRP Builtin group
      SID_TYPE_DELETED Deleted
      SID_TYPE_INVALID Invalid
      SID_TYPE_UNKNOWN Unknown
      Returns:
      type code
    • unwrap

      <T> T unwrap(Class<T> type)
      Unwraps this SID to the specified type.
      Type Parameters:
      T - the type to unwrap to
      Parameters:
      type - the class of the type to unwrap to
      Returns:
      unwrapped instance