Package waffle.servlet
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.- Author:
- dblock[at]dblock[dot]org
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WindowsPrincipal(IWindowsIdentity windowsIdentity)A windows principal.WindowsPrincipal(IWindowsIdentity windowsIdentity, PrincipalFormat principalFormat, PrincipalFormat roleFormat)A windows principal.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Map<String,WindowsAccount>getGroups()Windows groups that the user is a member of.IWindowsIdentitygetIdentity()Underlying identity.StringgetName()Fully qualified name.StringgetRolesString()Get an array of roles as a string.byte[]getSid()Byte representation of the SID.StringgetSidString()String representation of the SID.inthashCode()booleanhasRole(String role)Checks whether the principal has a given role.StringtoString()
-
-
-
Constructor Detail
-
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 Detail
-
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.
-
getIdentity
public IWindowsIdentity getIdentity()
Underlying identity.- Returns:
- String.
-
toString
public String toString()
-
equals
public boolean equals(Object o)
-
-