Book Image

Learning Node.js for .NET Developers

Book Image

Learning Node.js for .NET Developers

Overview of this book

Node.js is an open source, cross-platform runtime environment that allows you to use JavaScript to develop server-side web applications. This short guide will help you develop applications using JavaScript and Node.js, leverage your existing programming skills from .NET or Java, and make the most of these other platforms through understanding the Node.js programming model. You will learn how to build web applications and APIs in Node, discover packages in the Node.js ecosystem, test and deploy your Node.js code, and more. Finally, you will discover how to integrate Node.js and .NET code.
Table of Contents (21 chapters)
Learning Node.js for .NET Developers
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Introducing Passport


Passport is an authentication framework for Node.js. It can act as Express middleware, making it easy to integrate with our application.

Like some of the other libraries we've discussed so far, Passport is very modular. Its core package provides a common paradigm for authentication. Passport's middleware performs authentication and augments the request object with a user property.

Additional Passport npm packages support hundreds of different strategies for authentication. Each Passport strategy provides a different mechanism for identifying users. We'll look at a few of these strategies in this chapter. Passport makes it easy to add new strategies to suit the needs of each application.

Choosing an authentication strategy

A common introductory example is username/password-based authentication. This uses a login form to verify users' credentials against the application's database. Although this is one of the simplest authentication mechanisms to understand, it's not the most...