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

sails-uwshib

v0.1.3

Published

A sails-auth compatible implementation of Passport authentication strategy for University of Washington's Shibboleth service.

Downloads

19

Readme

Sails-UWShib

This package implements a Passportjs authentication strategy that works with the University of Washington's Shibboleth single-sign on service. This package uses the passport-saml package for all the heavy lifting, but sets all the default options so that it works properly with the UW Shibboleth Identity Provider (IdP).

This strategy is based on the Passport-UWShib package created by David Stearns and was modified to support the passport authentication integration pattern used by sails-auth. Please see the GitHub repositories for the passport-uwshib and sails-auth packages for implementation details.

Installation

Simply use NPM to install the package as a project dependency.

npm install sails-uwshib --save

Configuration

While this strategy will work with any Passportjs-based authentication implementation, these configuration instructions are specific to sails-auth.

Start by following the first two steps of the sails-auth module configuration.

< project >/config/passport.js Setup the passport configuration object.

passport: {
  uwsaml: {
    name:     'UW Shibboleth',
    protocol: 'uwsaml',
    strategy: require('sails-uwshib').Strategy,
    options:  {
      entityId:    'https://' + domain,
      privateKey:  privateKey,
      callbackUrl: '/auth/uwsaml/callback',
      domain:      domain
    }
  }
}

The domain and privateKey variables need to be set before the configuration object is created. These variables can be read from environment variables and / or the file system.

The callbackUrl follows the pattern established by sails-auth and should not be changed.

< project >/config/routes/sails-auth.js The default sails-auth installation defines a route for the authentication callback. However, the dependent passport-saml module requires a POST http method rather hand a GET, so you'll have to create a new route and point it at the AuthController.callback method.

routes: {
  'post /auth/:provider/callback': 'AuthController.callback'

< project >/services/protocols/uwsaml.js Create the sails-auth Passport protocol adapter file.

'use strict';
module.exports = function (req, profile, next) {
  var query = {
    identifier: profile.netId,
    protocol:   'uwsaml'
  };

  sails.services.passport.connect(req, query, profile, next);
};

< project >/services/protocols/index.js Require the uwsaml.js protocol file.

uwsaml: require('./uwsaml')

< project >/services/protocols/passport.js There is currently a bug in sails-auth (as of version v1.3.1) that prevents local project protocol files from being loaded. Add the following line to work around the bug.

protocols: require('./protocols')

Database Setup

Before you can authenticate, you must make sure that the database contains the tables for the Passport and User models. You will either need to migrate your dev database to your test and production servers or sails lift your application in development mode. Another solution is to temporarily point your development application at your test or production database server.

Authenticate

When the application is running, you can initiate authentication at the /auth/uwsaml route. The application will redirect you to the /auth/uwsaml/callback route and display your user information in JSON format after successful authentication.