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.- Author:
- dblock[at]dblock[dot]org
-
-
Constructor Summary
Constructors Constructor Description WindowsSecurityContextImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Disposes of the context.static booleandispose(com.sun.jna.platform.win32.Sspi.CtxtHandle ctx)Dispose a security context.static IWindowsSecurityContextgetCurrent(String securityPackage, String targetName)Get the current Windows security context for a given SSPI package.com.sun.jna.platform.win32.Sspi.CtxtHandlegetHandle()Context handle.IWindowsIdentitygetIdentity()Windows Identity.StringgetPrincipalName()Principal name.StringgetSecurityPackage()Security package name.byte[]getToken()Token.IWindowsImpersonationContextimpersonate()Impersonate this security context.voidinitialize(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.booleanisContinue()True if protocol requires continuation.voidsetContinue(boolean b)Sets the continue.voidsetCredentialsHandle(IWindowsCredentialsHandle handle)Sets the credentials handle.voidsetPrincipalName(String value)Sets the principal name.voidsetSecurityContext(com.sun.jna.platform.win32.Sspi.CtxtHandle phNewServerContext)Sets the security context.voidsetSecurityPackage(String value)Sets the security package.voidsetToken(byte[] bytes)Sets the token.
-
-
-
Method Detail
-
impersonate
public IWindowsImpersonationContext impersonate()
Description copied from interface:IWindowsSecurityContextImpersonate this security context.- Specified by:
impersonatein interfaceIWindowsSecurityContext- Returns:
- A Windows Impersonation Context.
-
getIdentity
public IWindowsIdentity getIdentity()
Description copied from interface:IWindowsSecurityContextWindows Identity.- Specified by:
getIdentityin interfaceIWindowsSecurityContext- Returns:
- Windows Identity.
-
getSecurityPackage
public String getSecurityPackage()
Description copied from interface:IWindowsSecurityContextSecurity package name.- Specified by:
getSecurityPackagein interfaceIWindowsSecurityContext- Returns:
- String.
-
getToken
public byte[] getToken()
Description copied from interface:IWindowsSecurityContextToken.- Specified by:
getTokenin interfaceIWindowsSecurityContext- 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:IWindowsSecurityContextInitialize the security context, continuing from a previous one.- Specified by:
initializein 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:IWindowsSecurityContextDisposes of the context.- Specified by:
disposein 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
public String getPrincipalName()
Description copied from interface:IWindowsSecurityContextPrincipal name.- Specified by:
getPrincipalNamein interfaceIWindowsSecurityContext- 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:IWindowsSecurityContextContext handle.- Specified by:
getHandlein interfaceIWindowsSecurityContext- 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:IWindowsSecurityContextTrue if protocol requires continuation.- Specified by:
isContinuein interfaceIWindowsSecurityContext- Returns:
- True or false.
-
setContinue
public void setContinue(boolean b)
Sets the continue.- Parameters:
b- the new continue
-
-