Module waffle.jna
Package waffle.windows.auth.impl

# Class WindowsSecurityContextImpl

java.lang.Object
waffle.windows.auth.impl.WindowsSecurityContextImpl

All Implemented Interfaces:
  `IWindowsSecurityContext`

public class WindowsSecurityContextImpl extends Object implements IWindowsSecurityContext
Windows Security Context.

## Constructor Summary

Constructors
Constructor
Description
`WindowsSecurityContextImpl()`

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
Disposes of the context.
`static boolean`
`dispose(com.sun.jna.platform.win32.Sspi.CtxtHandle ctx)`
Dispose a security context.
`static IWindowsSecurityContext`
`getCurrent(String securityPackage, String targetName)`
Get the current Windows security context for a given SSPI package.
`com.sun.jna.platform.win32.Sspi.CtxtHandle`
`getHandle()`
Context handle.
`IWindowsIdentity`
`getIdentity()`
Windows Identity.
`String`
`getPrincipalName()`
Principal name.
`String`
`getSecurityPackage()`
Security package name.
`byte[]`
`getToken()`
Token.
`IWindowsImpersonationContext`
`impersonate()`
Impersonate this security context.
`void`
`initialize(com.sun.jna.platform.win32.Sspi.CtxtHandle continueCtx, com.sun.jna.platform.win32.Sspi.SecBufferDesc continueToken, String targetName)`
Initialize the security context, continuing from a previous one.
`boolean`
`isContinue()`
True if protocol requires continuation.
`void`
`setContinue(boolean b)`
Sets the continue.
`void`
`setCredentialsHandle(IWindowsCredentialsHandle handle)`
Sets the credentials handle.
`void`
`setPrincipalName(String value)`
Sets the principal name.
`void`
`setSecurityContext(com.sun.jna.platform.win32.Sspi.CtxtHandle phNewServerContext)`
Sets the security context.
`void`
`setSecurityPackage(String value)`
Sets the security package.
`void`
`setToken(byte[] bytes)`
Sets the token.

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### WindowsSecurityContextImpl

public WindowsSecurityContextImpl()

## Method Details

### impersonate

public IWindowsImpersonationContext impersonate()
Description copied from interface: `IWindowsSecurityContext`
Impersonate this security context.

Specified by:
  `impersonate` in interface `IWindowsSecurityContext`
Returns:
  A Windows Impersonation Context.

### getIdentity

public IWindowsIdentity getIdentity()
Description copied from interface: `IWindowsSecurityContext`
Windows Identity.

Specified by:
  `getIdentity` in interface `IWindowsSecurityContext`
Returns:
  Windows Identity.

### getSecurityPackage

public String getSecurityPackage()
Description copied from interface: `IWindowsSecurityContext`
Security package name.

Specified by:
  `getSecurityPackage` in interface `IWindowsSecurityContext`
Returns:
  String.

### getToken

public byte[] getToken()
Description copied from interface: `IWindowsSecurityContext`
Token.

Specified by:
  `getToken` in interface `IWindowsSecurityContext`
Returns:
  Array of bytes.

### getCurrent

public static IWindowsSecurityContext getCurrent(String securityPackage, String targetName)
Get the current Windows security context for a given SSPI package.

Parameters:
  `securityPackage` - SSPI package.
  `targetName` - The target of the context. The string contents are security-package specific.
Returns:
  Windows security context.

### initialize

public void initialize(com.sun.jna.platform.win32.Sspi.CtxtHandle continueCtx, com.sun.jna.platform.win32.Sspi.SecBufferDesc continueToken, String targetName)
Description copied from interface: `IWindowsSecurityContext`
Initialize the security context, continuing from a previous one.

Specified by:
  `initialize` in interface `IWindowsSecurityContext`
Parameters:
  `continueCtx` - Continue context.
  `continueToken` - Continue token.
  `targetName` - The target of the context. The string contents are security-package specific.

### dispose

public void dispose()
Description copied from interface: `IWindowsSecurityContext`
Disposes of the context.

Specified by:
  `dispose` in interface `IWindowsSecurityContext`

### dispose

public static boolean dispose(com.sun.jna.platform.win32.Sspi.CtxtHandle ctx)
Dispose a security context.

Parameters:
  `ctx` - Security context.
Returns:
  True if a context was disposed.

### getPrincipalName

public String getPrincipalName()
Description copied from interface: `IWindowsSecurityContext`
Principal name.

Specified by:
  `getPrincipalName` in interface `IWindowsSecurityContext`
Returns:
  String.

### setPrincipalName

public void setPrincipalName(String value)
Sets the principal name.

Parameters:
  `value` - the new principal name

### getHandle

public com.sun.jna.platform.win32.Sspi.CtxtHandle getHandle()
Description copied from interface: `IWindowsSecurityContext`
Context handle.

Specified by:
  `getHandle` in interface `IWindowsSecurityContext`
Returns:
  Handle.

### setCredentialsHandle

public void setCredentialsHandle(IWindowsCredentialsHandle handle)
Sets the credentials handle.

Parameters:
  `handle` - the new credentials handle

### setToken

public void setToken(byte[] bytes)
Sets the token.

Parameters:
  `bytes` - the new token

### setSecurityPackage

public void setSecurityPackage(String value)
Sets the security package.

Parameters:
  `value` - the new security package

### setSecurityContext

public void setSecurityContext(com.sun.jna.platform.win32.Sspi.CtxtHandle phNewServerContext)
Sets the security context.

Parameters:
  `phNewServerContext` - the new security context

### isContinue

public boolean isContinue()
Description copied from interface: `IWindowsSecurityContext`
True if protocol requires continuation.

Specified by:
  `isContinue` in interface `IWindowsSecurityContext`
Returns:
  True or false.

### setContinue

public void setContinue(boolean b)
Sets the continue.

Parameters:
  `b` - the new continue