Module waffle.jna
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.

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

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`Map<String,WindowsAccount>`
`getGroups()`
Windows groups that the user is a member of.
`IWindowsIdentity`
`getIdentity()`
Underlying identity.
`String`
`getName()`
Fully qualified name.
`String`
`getRolesString()`
Get an array of roles as a string.
`byte[]`
`getSid()`
Byte representation of the SID.
`String`
`getSidString()`
String representation of the SID.
`int`
`hashCode()`
`boolean`
`hasRole(String role)`
Checks whether the principal has a given role.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.security.Principal

`implies`

## 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

### getGroups

public Map<String,WindowsAccount> getGroups()
Windows groups that the user is a member of.

Returns:
  A map of group names to groups.

### getSid

public byte[] getSid()
Byte representation of the SID.

Returns:
  Array of bytes.

### getSidString

public String getSidString()
String representation of the SID.

Returns:
  String.

### 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`