Package waffle.windows.auth.impl
Class WindowsSecurityContextImpl
java.lang.Object
waffle.windows.auth.impl.WindowsSecurityContextImpl
- All Implemented Interfaces:
IWindowsSecurityContext
Windows Security Context.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Context handle.Windows Identity.Principal name.Security package name.byte[]
getToken()
Token.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
True if protocol requires continuation.void
setContinue
(boolean b) Sets the continue.void
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.
-
Constructor Details
-
WindowsSecurityContextImpl
public WindowsSecurityContextImpl()
-
-
Method Details
-
impersonate
Description copied from interface:IWindowsSecurityContext
Impersonate this security context.- Specified by:
impersonate
in interfaceIWindowsSecurityContext
- Returns:
- A Windows Impersonation Context.
-
getIdentity
Description copied from interface:IWindowsSecurityContext
Windows Identity.- Specified by:
getIdentity
in interfaceIWindowsSecurityContext
- Returns:
- Windows Identity.
-
getSecurityPackage
Description copied from interface:IWindowsSecurityContext
Security package name.- Specified by:
getSecurityPackage
in interfaceIWindowsSecurityContext
- Returns:
- String.
-
getToken
public byte[] getToken()Description copied from interface:IWindowsSecurityContext
Token.- Specified by:
getToken
in interfaceIWindowsSecurityContext
- Returns:
- Array of bytes.
-
getCurrent
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 interfaceIWindowsSecurityContext
- 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 interfaceIWindowsSecurityContext
-
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
Description copied from interface:IWindowsSecurityContext
Principal name.- Specified by:
getPrincipalName
in interfaceIWindowsSecurityContext
- Returns:
- String.
-
setPrincipalName
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 interfaceIWindowsSecurityContext
- Returns:
- Handle.
-
setCredentialsHandle
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
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 interfaceIWindowsSecurityContext
- Returns:
- True or false.
-
setContinue
public void setContinue(boolean b) Sets the continue.- Parameters:
b
- the new continue
-