final CtxtHandle phNewServerContext = new CtxtHandle(); rc = Secur32.INSTANCE.AcceptSecurityContext(serverCredential.getHandle(), continueHandle, pbClientToken, Sspi.ISC_REQ_CONNECTION, Sspi.SECURITY_NATIVE_DREP, phNewServerContext, pbServerToken,
final IntByReference pfClientContextAttr = new IntByReference(); final CtxtHandle phNewServerContext = new CtxtHandle(); rc = Secur32.INSTANCE.AcceptSecurityContext(serverCredential.getHandle(), continueHandle, pbClientToken, Sspi.ISC_REQ_CONNECTION, Sspi.SECURITY_NATIVE_DREP, phNewServerContext, pbServerToken,
final IntByReference pfClientContextAttr = new IntByReference(); final CtxtHandle phNewServerContext = new CtxtHandle(); rc = Secur32.INSTANCE.AcceptSecurityContext(serverCredential.getHandle(), continueHandle, pbClientToken, Sspi.ISC_REQ_CONNECTION, Sspi.SECURITY_NATIVE_DREP, phNewServerContext, pbServerToken,
@Override public void initialize(final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); this.ctx = new CtxtHandle(); int tokenSize = Sspi.MAX_TOKEN_SIZE; int rc; do { this.token = new ManagedSecBufferDesc(Sspi.SECBUFFER_TOKEN, tokenSize); rc = Secur32.INSTANCE.InitializeSecurityContext(this.credentials.getHandle(), continueCtx, targetName, Sspi.ISC_REQ_CONNECTION, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, this.ctx, this.token, attr, null); switch (rc) { case WinError.SEC_E_INSUFFICIENT_MEMORY: case WinError.SEC_E_BUFFER_TOO_SMALL: tokenSize += Sspi.MAX_TOKEN_SIZE; break; case WinError.SEC_I_CONTINUE_NEEDED: this.continueFlag = true; break; case WinError.SEC_E_OK: this.continueFlag = false; break; default: throw new Win32Exception(rc); } } while (rc == WinError.SEC_E_INSUFFICIENT_MEMORY || rc == WinError.SEC_E_BUFFER_TOO_SMALL); }
@Override public void initialize(final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); this.ctx = new CtxtHandle(); int tokenSize = Sspi.MAX_TOKEN_SIZE; int rc; do { this.token = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, tokenSize); rc = Secur32.INSTANCE.InitializeSecurityContext(this.credentials.getHandle(), continueCtx, targetName, Sspi.ISC_REQ_CONNECTION, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, this.ctx, this.token, attr, null); switch (rc) { case WinError.SEC_E_INSUFFICIENT_MEMORY: case WinError.SEC_E_BUFFER_TOO_SMALL: tokenSize += Sspi.MAX_TOKEN_SIZE; break; case WinError.SEC_I_CONTINUE_NEEDED: this.continueFlag = true; break; case WinError.SEC_E_OK: this.continueFlag = false; break; default: throw new Win32Exception(rc); } } while (rc == WinError.SEC_E_INSUFFICIENT_MEMORY || rc == WinError.SEC_E_BUFFER_TOO_SMALL); }
String getToken( final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); final ManagedSecBufferDesc token = new ManagedSecBufferDesc( Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE); sspiContext = new CtxtHandle(); final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred, continueCtx, targetName, Sspi.ISC_REQ_DELEGATE | Sspi.ISC_REQ_MUTUAL_AUTH, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sspiContext, token, attr, null); switch (rc) { case WinError.SEC_I_CONTINUE_NEEDED: continueNeeded = true; break; case WinError.SEC_E_OK: dispose(); // Don't keep the context continueNeeded = false; break; default: dispose(); throw new Win32Exception(rc); } return Base64.encodeBase64String(token.getBuffer(0).getBytes()); }
String getToken( final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); final SecBufferDesc token = new SecBufferDesc( Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE); sspiContext = new CtxtHandle(); final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred, continueCtx, targetName, Sspi.ISC_REQ_DELEGATE | Sspi.ISC_REQ_MUTUAL_AUTH, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sspiContext, token, attr, null); switch (rc) { case WinError.SEC_I_CONTINUE_NEEDED: continueNeeded = true; break; case WinError.SEC_E_OK: dispose(); // Don't keep the context continueNeeded = false; break; default: dispose(); throw new Win32Exception(rc); } return Base64.encodeBase64String(token.getBytes()); }
String getToken( final Sspi.CtxtHandle continueCtx, final Sspi.SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); final ManagedSecBufferDesc token = new ManagedSecBufferDesc( Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE); sspiContext = new Sspi.CtxtHandle(); final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred, continueCtx, targetName, Sspi.ISC_REQ_DELEGATE | Sspi.ISC_REQ_MUTUAL_AUTH, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sspiContext, token, attr, null); switch(rc) { case WinError.SEC_I_CONTINUE_NEEDED: continueNeeded = true; break; case WinError.SEC_E_OK: dispose(); // Don't keep the context continueNeeded = false; break; default: dispose(); throw new Win32Exception(rc); } return Base64.encodeBase64String(token.getBuffer(0).getBytes()); }
@Override public void initialize(final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { this.attr = new IntByReference(); this.ctx = new CtxtHandle(); int tokenSize = Sspi.MAX_TOKEN_SIZE; int rc; do { this.token = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, tokenSize); rc = Secur32.INSTANCE.InitializeSecurityContext(this.credentials.getHandle(), continueCtx, targetName, Sspi.ISC_REQ_CONNECTION, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, this.ctx, this.token, this.attr, null); switch (rc) { case WinError.SEC_E_INSUFFICIENT_MEMORY: tokenSize += Sspi.MAX_TOKEN_SIZE; break; case WinError.SEC_E_BUFFER_TOO_SMALL: tokenSize += Sspi.MAX_TOKEN_SIZE; break; case WinError.SEC_I_CONTINUE_NEEDED: this.continueFlag = true; break; case WinError.SEC_E_OK: this.continueFlag = false; break; default: throw new Win32Exception(rc); } } while (rc == WinError.SEC_E_INSUFFICIENT_MEMORY || rc == WinError.SEC_E_BUFFER_TOO_SMALL); }
/** * Dispose a security context. * * @param ctx * Security context. * @return True if a context was disposed. */ public static boolean dispose(final CtxtHandle ctx) { if (ctx != null && !ctx.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(ctx); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return true; } return false; }
public void dispose() { if (clientCred != null && !clientCred.isNull()) { final int rc = Secur32.INSTANCE.FreeCredentialsHandle(clientCred); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } if (sspiContext != null && !sspiContext.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(sspiContext); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } continueNeeded = true; // waiting clientCred = null; sspiContext = null; }
/** * Dispose a security context. * * @param ctx * Security context. * @return True if a context was disposed. */ public static boolean dispose(final CtxtHandle ctx) { if (ctx != null && !ctx.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(ctx); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return true; } return false; }
public void dispose() { if(clientCred != null && !clientCred.isNull()) { final int rc = Secur32.INSTANCE.FreeCredentialsHandle(clientCred); if(WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } if(sspiContext != null && !sspiContext.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(sspiContext); if(WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } continueNeeded = true; // waiting clientCred = null; sspiContext = null; }
/** * Dispose a security context. * * @param ctx * Security context. * @return True if a context was disposed. */ public static boolean dispose(final CtxtHandle ctx) { if (ctx != null && !ctx.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(ctx); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return true; } return false; }
public void dispose() { if (clientCred != null && !clientCred.isNull()) { final int rc = Secur32.INSTANCE.FreeCredentialsHandle(clientCred); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } if (sspiContext != null && !sspiContext.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(sspiContext); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } continueNeeded = true; // waiting clientCred = null; sspiContext = null; }
@Override public CtxtHandle getHandle() { return new CtxtHandle(); }
@Override public CtxtHandle getHandle() { return new CtxtHandle(); }
@Override public CtxtHandle getHandle() { return new CtxtHandle(); }
String getToken( final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) { final IntByReference attr = new IntByReference(); final ManagedSecBufferDesc token = new ManagedSecBufferDesc( Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE); sspiContext = new CtxtHandle(); final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred, continueCtx, targetName, Sspi.ISC_REQ_DELEGATE | Sspi.ISC_REQ_MUTUAL_AUTH, 0, Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sspiContext, token, attr, null); switch (rc) { case WinError.SEC_I_CONTINUE_NEEDED: continueNeeded = true; break; case WinError.SEC_E_OK: dispose(); // Don't keep the context continueNeeded = false; break; default: dispose(); throw new Win32Exception(rc); } return Base64.encodeBase64String(token.getBuffer(0).getBytes()); }
public void dispose() { if (clientCred != null && !clientCred.isNull()) { final int rc = Secur32.INSTANCE.FreeCredentialsHandle(clientCred); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } if (sspiContext != null && !sspiContext.isNull()) { final int rc = Secur32.INSTANCE.DeleteSecurityContext(sspiContext); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } } continueNeeded = true; // waiting clientCred = null; sspiContext = null; }