@gaincompliance/hapi-auth-stormpath
v1.1.25
Published
Stormpath authentication plugin for hapi
Downloads
49
Readme
hapi-auth-stormpath
Stormpath authentication plugin for hapi
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 applicationapiKeySecret
(required) - the api key secret from your Stormpath applicationapplicationHref
(required) - the url that identifies your application according to the Stormpath APIreturnUrl
(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'
};