Top Description Fields Constructors Methods
waffle.windows.auth.impl

public Class WindowsSecurityContextImpl

extends Object
implements IWindowsSecurityContext
Class Inheritance
All Implemented Interfaces
waffle.windows.auth.IWindowsSecurityContext
Imports
com.sun.jna.platform.win32.Secur32, .Sspi, .Sspi.CtxtHandle, .Sspi.SecBufferDesc, .SspiUtil.ManagedSecBufferDesc, .Win32Exception, .WinError, .WinNT.HANDLEByReference, com.sun.jna.ptr.IntByReference, waffle.windows.auth.IWindowsCredentialsHandle, .IWindowsIdentity, .IWindowsImpersonationContext, .IWindowsSecurityContext

Windows Security Context.
Author
dblock[at]dblock[dot]org

Field Summary

Modifier and TypeField and Description
private boolean
continueFlag

The continue flag.

private IWindowsCredentialsHandle
credentials

The credentials.

private Sspi.CtxtHandle
ctx

The ctx.

private String
principalName

The principal name.

private String
securityPackage

The security package.

private SspiUtil.ManagedSecBufferDesc
token

The token.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements waffle.windows.auth.IWindowsSecurityContext.dispose.

Disposes of the context.
public static boolean

Returns:

True if a context was disposed.
dispose
(final Sspi.CtxtHandle
Security context.
ctx
)

Dispose a security context.

public static IWindowsSecurityContext

Returns:

Windows security context.
getCurrent
(final String
SSPI package.
securityPackage
,
final String
The target of the context. The string contents are security-package specific.
targetName
)

Get the current Windows security context for a given SSPI package.

public Sspi.CtxtHandle
public IWindowsIdentity
public String
public String
public byte[]
public IWindowsImpersonationContext
impersonate()

Implements waffle.windows.auth.IWindowsSecurityContext.impersonate.

Impersonate this security context.
public void
initialize(final Sspi.CtxtHandle
Continue context.
continueCtx
,
final Sspi.SecBufferDesc
Continue token.
continueToken
,
final String
The target of the context. The string contents are security-package specific.
targetName
)

Implements waffle.windows.auth.IWindowsSecurityContext.initialize.

Initialize the security context, continuing from a previous one.
public boolean
isContinue()

Implements waffle.windows.auth.IWindowsSecurityContext.isContinue.

True if protocol requires continuation.
public void
setContinue(final boolean
the new continue
b
)

Sets the continue.

public void
setCredentialsHandle(final IWindowsCredentialsHandle
the new credentials handle
handle
)

Sets the credentials handle.

public void
setPrincipalName(final String
the new principal name
value
)

Sets the principal name.

public void
setSecurityContext(final Sspi.CtxtHandle
the new security context
phNewServerContext
)

Sets the security context.

public void
setSecurityPackage(final String
the new security package
value
)

Sets the security package.

public void
setToken(final byte[]
the new token
bytes
)

Sets the token.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

continueFlagback to summary
private boolean continueFlag

The continue flag.

credentialsback to summary
private IWindowsCredentialsHandle credentials

The credentials.

ctxback to summary
private Sspi.CtxtHandle ctx

The ctx.

principalNameback to summary
private String principalName

The principal name.

securityPackageback to summary
private String securityPackage

The security package.

tokenback to summary
private SspiUtil.ManagedSecBufferDesc token

The token.

Constructor Detail

WindowsSecurityContextImplback to summary
public WindowsSecurityContextImpl()

Method Detail

disposeback to summary
public void dispose()

Implements waffle.windows.auth.IWindowsSecurityContext.dispose.

Doc from waffle.windows.auth.IWindowsSecurityContext.dispose.

Disposes of the context.

Annotations
@Override
disposeback to summary
public static boolean dispose(final Sspi.CtxtHandle ctx)

Dispose a security context.

Parameters
ctx:Sspi.CtxtHandle

Security context.

Returns:boolean

True if a context was disposed.

getCurrentback to summary
public static IWindowsSecurityContext getCurrent(final String securityPackage, final String targetName)

Get the current Windows security context for a given SSPI package.

Parameters
securityPackage:String

SSPI package.

targetName:String

The target of the context. The string contents are security-package specific.

Returns:IWindowsSecurityContext

Windows security context.

getHandleback to summary
public Sspi.CtxtHandle getHandle()

Implements waffle.windows.auth.IWindowsSecurityContext.getHandle.

Doc from waffle.windows.auth.IWindowsSecurityContext.getHandle.

Context handle.

Returns:Sspi.CtxtHandle

Handle.

Annotations
@Override
getIdentityback to summary
public IWindowsIdentity getIdentity()

Implements waffle.windows.auth.IWindowsSecurityContext.getIdentity.

Doc from waffle.windows.auth.IWindowsSecurityContext.getIdentity.

Windows Identity.

Returns:IWindowsIdentity

Windows Identity.

Annotations
@Override
getPrincipalNameback to summary
public String getPrincipalName()

Implements waffle.windows.auth.IWindowsSecurityContext.getPrincipalName.

Doc from waffle.windows.auth.IWindowsSecurityContext.getPrincipalName.

Principal name.

Returns:String

String.

Annotations
@Override
getSecurityPackageback to summary
public String getSecurityPackage()

Implements waffle.windows.auth.IWindowsSecurityContext.getSecurityPackage.

Doc from waffle.windows.auth.IWindowsSecurityContext.getSecurityPackage.

Security package name.

Returns:String

String.

Annotations
@Override
getTokenback to summary
public byte[] getToken()

Implements waffle.windows.auth.IWindowsSecurityContext.getToken.

Doc from waffle.windows.auth.IWindowsSecurityContext.getToken.

Token.

Returns:byte[]

Array of bytes.

Annotations
@Override
impersonateback to summary
public IWindowsImpersonationContext impersonate()

Implements waffle.windows.auth.IWindowsSecurityContext.impersonate.

Doc from waffle.windows.auth.IWindowsSecurityContext.impersonate.

Impersonate this security context.

Returns:IWindowsImpersonationContext

A Windows Impersonation Context.

Annotations
@Override
initializeback to summary
public void initialize(final Sspi.CtxtHandle continueCtx, final Sspi.SecBufferDesc continueToken, final String targetName)

Implements waffle.windows.auth.IWindowsSecurityContext.initialize.

Doc from waffle.windows.auth.IWindowsSecurityContext.initialize.

Initialize the security context, continuing from a previous one.

Parameters
continueCtx:Sspi.CtxtHandle

Continue context.

continueToken:Sspi.SecBufferDesc

Continue token.

targetName:String

The target of the context. The string contents are security-package specific.

Annotations
@Override
isContinueback to summary
public boolean isContinue()

Implements waffle.windows.auth.IWindowsSecurityContext.isContinue.

Doc from waffle.windows.auth.IWindowsSecurityContext.isContinue.

True if protocol requires continuation.

Returns:boolean

True or false.

Annotations
@Override
setContinueback to summary
public void setContinue(final boolean b)

Sets the continue.

Parameters
b:boolean

the new continue

setCredentialsHandleback to summary
public void setCredentialsHandle(final IWindowsCredentialsHandle handle)

Sets the credentials handle.

Parameters
handle:IWindowsCredentialsHandle

the new credentials handle

setPrincipalNameback to summary
public void setPrincipalName(final String value)

Sets the principal name.

Parameters
value:String

the new principal name

setSecurityContextback to summary
public void setSecurityContext(final Sspi.CtxtHandle phNewServerContext)

Sets the security context.

Parameters
phNewServerContext:Sspi.CtxtHandle

the new security context

setSecurityPackageback to summary
public void setSecurityPackage(final String value)

Sets the security package.

Parameters
value:String

the new security package

setTokenback to summary
public void setToken(final byte[] bytes)

Sets the token.

Parameters
bytes:byte[]

the new token