Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

passport-azure-ad

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-azure-ad

WSFED/SAMLP/OIDC/Bearer Passport strategies for Azure Active Directory

  • 1.4.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
171K
increased by4.7%
Maintainers
2
Weekly downloads
 
Created

What is passport-azure-ad?

The passport-azure-ad npm package provides authentication and authorization strategies for integrating with Microsoft Azure Active Directory (Azure AD) using the Passport.js framework. It supports various authentication flows including OAuth2, OpenID Connect, and SAML.

What are passport-azure-ad's main functionalities?

OAuth2 Bearer Strategy

This feature allows you to authenticate users using OAuth2 Bearer tokens issued by Azure AD. The code sample demonstrates how to configure and use the BearerStrategy with Passport.js.

const passport = require('passport');
const BearerStrategy = require('passport-azure-ad').BearerStrategy;

const options = {
  identityMetadata: 'https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration',
  clientID: 'your-client-id',
  validateIssuer: true,
  issuer: 'https://sts.windows.net/{tenant-id}/',
  passReqToCallback: false
};

passport.use(new BearerStrategy(options, (token, done) => {
  // Token validation logic
  done(null, token);
}));

OIDC Strategy

This feature allows you to authenticate users using OpenID Connect (OIDC) with Azure AD. The code sample demonstrates how to configure and use the OIDCStrategy with Passport.js.

const passport = require('passport');
const OIDCStrategy = require('passport-azure-ad').OIDCStrategy;

const options = {
  identityMetadata: 'https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration',
  clientID: 'your-client-id',
  responseType: 'code id_token',
  responseMode: 'form_post',
  redirectUrl: 'http://localhost:3000/auth/openid/return',
  allowHttpForRedirectUrl: true,
  clientSecret: 'your-client-secret',
  validateIssuer: true,
  passReqToCallback: false
};

passport.use(new OIDCStrategy(options, (iss, sub, profile, accessToken, refreshToken, done) => {
  // User profile validation logic
  done(null, profile);
}));

SAML Strategy

This feature allows you to authenticate users using SAML with Azure AD. The code sample demonstrates how to configure and use the SamlStrategy with Passport.js.

const passport = require('passport');
const SamlStrategy = require('passport-azure-ad').SamlStrategy;

const options = {
  identityMetadata: 'https://login.microsoftonline.com/{tenant}/federationmetadata/2007-06/federationmetadata.xml',
  loginCallback: 'http://localhost:3000/auth/saml/callback',
  issuer: 'your-issuer',
  audience: 'your-audience',
  cert: 'your-certificate',
  privateCert: 'your-private-certificate'
};

passport.use(new SamlStrategy(options, (profile, done) => {
  // User profile validation logic
  done(null, profile);
}));

Other packages similar to passport-azure-ad

Keywords

FAQs

Package last updated on 14 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc