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

passport-ntlm

v0.3.0

Published

Strategy for passport module, that provides Windows SSO (NTLM) based authentication, validating password using SMB

Downloads

19

Readme

Passport-NTLM

NTLM (a.k.a Windows SSO) authentication strategy for Passport.

This module lets you authenticate HTTP requests using Integrated Windows Authentication in your Node.js applications. Currently it implements only NTLM based authentication. By plugging into Passport, support for this scheme can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

The authentication mechanism involves the application requesting the credentials of the currently logged in Windows domain user, encrypted using the key obtained from one of the domain controllers and passing it on to the domain controller for validation. In this mechanism the application receives only the encrypted password of the user, encrypted using a key generated by the domain controller, that is valid only for one authentication session with the domain controller.

The module works by obtaining encryption key (session key) from the domain controller and challenging the client browser with the key to receive the encrypted credentials and clear text user name, which is then passed along to the domain controller.

For more information refer to

  • [Microsoft SMB Protocol and CIFS Protocol Overview https://msdn.microsoft.com/en-us/library/windows/desktop/aa365233(v=vs.85).aspx]
  • [MS-CIFS https://msdn.microsoft.com/en-us/library/ee442092.aspx]
  • [MS-SMB https://msdn.microsoft.com/en-us/library/cc246231.aspx]

Install

$ npm install passport-ntlm

Usage of NTLM

Configure Strategy

The NTLM authentication strategy authenticates using the credentials sent by the browser automatically, in response to the NTLM challenge. The strategy requires an options object and a verify callback. The options must include one of domainDNS, domain or smbServer, which will be used to identify the server to validate the credentials. The verify callback must accept the username and call done provinding a user.

    var NTLMStrategy = require('passport-ntlm').Strategy
	passport.use(new NTLMStrategy({domain:'WINDOWSDOMAIN'},
	  function(username, done) {
		var user={ username: username };
		  return done(null, user);
	  }
	));	  
	

Use passport.authenticate(), specifying the 'ntlm' strategy, to authenticate requests. Since NTLM authentication requests make multiple exchanges and require the corresponding SMB session to be active till the authentication is complete session support is needed.

For example, as route middleware in an Express application:

app.get('/private', 
  passport.authenticate('ntlm', { session: false }),
  function(req, res) {
    res.json(req.user);
	next();
  });

Credits

License

The MIT License