npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

scptre-sspi-client

v0.2.11

Published

Fork of the sspi-client module to support NodeJS version 12+.

Downloads

26

Readme

Client Side SSPI Authentication Module.

Fork Overview

The sspi-client module does not support NodeJS versions greater than 11. i.e. Due to build errors such as

error C2660: 'v8::Value::BooleanValue': function does not take 0 arguments

These APIs had been marked as depreciated and were removed in NodeJS 12. This fork allows the sspi-client module to support the newer (and older) versions of NodeJS. It has been verified against NodeJS versions

  • 18.16.0
  • 14.2.0
  • 12.16.3
  • 10.19.0

A pull request against the original module was created to support the latest releases. But no response was received and it appears that module is no longer maintained.

Overview

SSPI is a Microsoft specific API that may be used by applications for authenticated communications. This allows an application to use various available security modules without changing the interface to the security system. The actual security model is implemented by security packages installed on the system. For more information, see SSPI.

Windows implementation of SSPI is in native code, making it available only for C/C++ applications. sspi-client module provides a JavaScript interface for applications that need to communicate with a server using SSPI. Primary motivitation for building this module is to help implement Windows Integrated Authentication in Tedious.

This is currently only supported on Windows and for Node version > 4.0.0.

API Documentation

Below is the API listing with brief optional descriptions. Refer to comments on the corresponding functions and classes in code.

sspi_client

SspiClient Class

This class has the core functionality implemented by the module.

constructor
var sspiClient = new SspiClientApi.SspiClient(spn, securityPackage);

You may get spn by invoking makeSpn() which takes an FQDN. If you only have simple hostname or IP address, you may get FQDN by invoking getFqdn() and then pass it to makeSpn.

getNextBlob
SspiClient.getNextBlob(serverResponse, serverResponseBeginOffset, serverResponseLength, cb)

This function takes the server response and makes SSPI calls to get the client response to send back to the server. You can use just this function to implement client side SSPI based authentication. This will do initialization if needed.

ensureInitialization

ensureInitialization(cb);

Do initialization if needed.

getAvailableSspiPackageNames

var availableSspiPackageNames = getAvailableSspiPackageNames();

Initialization must be completed before this function may be invoked.

getDefaultSspiPackageName

var defaultPackageName = getDefaultSspiPackageName();

Initialization must be completed before this function may be invoked.

enableNativeDebugLogging

enableNativeDebugging();

Logs detailed debug information from native code.

disableNativeDebugLogging

disableNativeDebugLogging();

This together with enableNativeDebugging allows for enabling debug logging for targeted sections of the application.

fqdn

getFqdn

getFqdn(hostidentifier, cb);

Resolves an IP address or hostname to an FQDN.

make_spn

makeSpn

var spn = makeSpn(serviceClassName, fqdn, instanceNameOrPort;

Puts together the parameters passed in return the Service Principal Name.

Sample code

For a complete sample, see Sample Code.

Developer Notes

This section has notes for developers to be able to build and run tests.

Setup and Build

Install NodeJS. Duh!
npm install -g node-gyp
git clone https://github.com/tvrprasad/sspi-client.git
cd sspi-client
npm install

Run Tests

Setup

Copy test_config.json to %USERPROFILE%.sspi-client\test_config.json
Tweak the values in the file to have the right values for yoursetup. Should be self-explanatory. This setup is needed for running both unit and integration tests.

Unit Tests

npm run-script test

Integration Tests

Integration tests are currently manual but hopefully not too tedious. They test the functionality end to end. These tests are in the directory test\integration.

sspi_client_test.js

This test sets up a SSPI server and runs SSPI client to connect with it. Follow instructions in README_sspi_client_test.md to run this test.

sqlconnect_windows_integrated_auth.js

This test validates integration with Tedious by attempting to connect and run a simple query for the following matrix:

  1. Two instances of SQL Server, one local and one remote.
  2. Supported SSPI protocols - negotiate, kerberos, ntlm.
  3. TLS encryption on and off.

Follow instructions in README_sqlconnect.md to run this test.

sqlconnect_stress.js

This test validates integration with Tedious under stress by attempting to open about 1000 connections in parallel and run a simple query on each connection, again in parallel. The mix of connections is as below:

  1. Two instances of SQL Server, one local and one remote.
  2. Supported SSPI protocols - negotiate, kerberos, ntlm.
  3. TLS encryption on and off.

Follow instructions in README_sqlconnect.md to run this test.