Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

GainCompliance/hapi-auth-stormpath

Repository files navigation

hapi-auth-stormpath

Stormpath authentication plugin for hapi

No Maintenance Intended The Stormpath service has been shut down, so this plugin no longer provides value.

npm license

Build Status Codecov

Commitizen friendly semantic-release greenkeeper badge

Installation

$ npm install @gaincompliance/hapi-auth-stormpath -S

Usage

Include this plugin in the manifest of your hapi application to make the Stormpath authentication scheme available to your application. When registered for a route, a user will be directed to Stormpath's ID Site for your registered application to authenticate.

Once the scheme has been registered, register a strategy that uses the stormpath scheme provided by this plugin.

Configuration

When registering the strategy, be sure to provide the following required configuration:

  • apiKeyId (required) - the api key ID for your Stormpath application
  • apiKeySecret (required) - the api key secret from your Stormpath application
  • applicationHref (required) - the url that identifies your application according to the Stormpath API
  • returnUrl (required) - the fully qualified url that ID Site should send the user back to after authentication

Example

export function register(server, options, next) {
  server.auth.strategy('stormpath', 'stormpath', {
    apiKeyId: process.env.SP_API_KEY_ID,
    apiKeySecret: process.env.SP_API_KEY_SECRET,
    applicationHref: `https://api.stormpath.com/v1/applications/${process.env.STORMPATH_APPLICATION_ID}`,
    returnUrl: 'https://your.site.com/login'
  });

  next();
}

register.attributes = {
  name: 'authentication-strategy'
};