Class WindowsPrincipal

java.lang.Object
waffle.servlet.WindowsPrincipal
All Implemented Interfaces:
Serializable, Principal
Direct Known Subclasses:
AutoDisposableWindowsPrincipal

public class WindowsPrincipal extends Object implements Principal, Serializable
A Windows Principal.
See Also:
  • Constructor Details

    • WindowsPrincipal

      public WindowsPrincipal(IWindowsIdentity windowsIdentity)
      A windows principal.
      Parameters:
      windowsIdentity - Windows identity.
    • WindowsPrincipal

      public WindowsPrincipal(IWindowsIdentity windowsIdentity, PrincipalFormat principalFormat, PrincipalFormat roleFormat)
      A windows principal.
      Parameters:
      windowsIdentity - Windows identity.
      principalFormat - Principal format.
      roleFormat - Role format.
  • Method Details

    • getSid

      public byte[] getSid()
      Byte representation of the SID.
      Returns:
      Array of bytes.
    • getSidString

      public String getSidString()
      String representation of the SID.
      Returns:
      String.
    • getGroups

      public Map<String,WindowsAccount> getGroups()
      Windows groups that the user is a member of.
      Returns:
      A map of group names to groups.
    • getRolesString

      public String getRolesString()
      Get an array of roles as a string.
      Returns:
      Role1, Role2, ...
    • hasRole

      public boolean hasRole(String role)
      Checks whether the principal has a given role.
      Parameters:
      role - Role name.
      Returns:
      True if the principal has a role, false otherwise.
    • getName

      public String getName()
      Fully qualified name.
      Specified by:
      getName in interface Principal
      Returns:
      String.
    • getIdentity

      public IWindowsIdentity getIdentity()
      Underlying identity.
      Returns:
      String.
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object