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-shraga

v1.4.0

Published

[passport-shraga](https://github.com/ShragaUser/passport-shraga) is a [passport.js](http://www.passportjs.org/) authentication strategy that utilizes [Shraga](https://shragauser.github.io/adfs-proxy-shraga/) as an saml-idp proxy.

Downloads

173

Readme

Passport-Shraga

passport-shraga is a passport.js authentication strategy that utilizes Shraga as an saml-idp proxy.

npm version

NPM


Usage

passport.js

usage of passport-shraga is as followed:

const passport = require("passport");
const { Strategy } = require("passport-shraga");

passport.serializeUser((user, cb) => {
    //serialize function
});

passport.deserializeUser((id, cb) => {
    ///deserialize function
});

const config = {};

passport.use(new Strategy(config, (profile, done) => {
    console.log(`My Profile Is: ${profile}`);
    done(null, profile);
}))

Strategy configuration options (1):

callbackURL: callback url for Shraga to return the signed JWT. Can be absolute or relative ( http://my-domian/path-to-callback OR /path-to-callback )

shragaURL: Full URL to the Shraga instance running.

transform: Function Or Mapping-Object that transforms profile returned from Shraga.


Strategy configuration options (2):

useEnrichId: (boolean) set to true if you want Shraga to return user profile with enrichId. set to false to return user profile with SAML provider id.

allowedProviders: Array of allowed identity provider names - if argument is provided only identity providers in this list are allowed to return user profiles. disallowed providers will be followed with authentication failure.

RelayState: If RelayState is provided its value will be returned with user profile inside jwtBody ( as 'RelayState' ).


Transform option:

the tranform option can be configured if early manipulation of the User profile is required. transform can ve a function or an object:


  • in case of Function: the function will recieve the profile and do any manipulation wanted then returns a new profile object to replace current user Profile. example:
const tranform = (user) => {
  const fullName = `${user.firstName} ${user.lastNmae}`;
  return {...user, fullName};
}

  • in case of Object: the object will act as a mapper and can decide which user properties will be passed on to Authenticate function and under which name they will be passed on as. example:
const transform = {"id": "userId", "firstName":"fname", "lastName":"lname"};

the returned object would be:

{userId: ObjectID, fname: String, lname: String}