Java 类com.sun.jna.platform.win32.Sspi.SecBufferDesc 实例源码

项目:purecloud-iot    文件:WindowsNegotiateScheme.java   
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());
}
项目:purecloud-iot    文件:TestWindowsNegotiateScheme.java   
@Override
String getToken(final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetName) {
    dispose();
    /* We will rather throw SEC_E_TARGET_UNKNOWN because SEC_E_DOWNGRADE_DETECTED is not
     * available on Windows XP and this unit test always fails.
     */
    throw new Win32Exception(WinError.SEC_E_TARGET_UNKNOWN);
}
项目:armor    文件:MockWindowsSecurityContext.java   
@Override
public void initialize(final CtxtHandle continueCtx, final SecBufferDesc continueToken, final String targetPrincipalName) {
    // Do Nothing
}