GithubHelp home page GithubHelp logo

passport-ntlm's Introduction

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

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

passport-ntlm's People

Contributors

kkleokrish avatar

Watchers

Jeff Lewis avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.