JSPM

cfii-hapi-saml-sso

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q26730F

SAML endpoints

Package Exports

  • cfii-hapi-saml-sso

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cfii-hapi-saml-sso) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hapi-saml-sso

Logo

hapi-saml-sso is a hapi.js plugin, it will use the passport-saml library and provide possibility to implement Single Sign On in your app using SAML protocol

Notes

This plugin based on passport-saml.

Please, check original repository and specs for clear understanding.

Getting Started

npm install hapi-saml-sso --save

Add the plugin into your app and set following options:

const Hapi = require('hapi');
const server = new Hapi.Server();

const plugins = [
    {
        register: require('hapi-saml-sso'),
        options: {
            callbackUrl: 'https://your-app.com/callback',
            host: 'your-app.com',
            protocol: 'https',
            path: '/callback',
            signatureAlgorithm: 'sha1',
            entryPoint: 'https://your-saml-identity-provider',
            issuer: 'https://your-saml-service-provider',
            cert: 'yourCertificate',
            decryptionCert: 'test',
            decryptionPvk: true

        }
    }
];

server.connection({ port: 8000 });

server.register(plugins, (err) => {

    if (err) {
        throw err;
    }
    server.start((err) => {

        if (err) {
            throw err;
        }
        console.log(`Server running at: ${server.info.uri}`);
    });
});

Plugin provide following SSO API:

GET  /saml/metadata.xml
GET  /saml/login
GET  /saml/logout

Also plugin has already implemented SSO callback

POST /saml/callback

For correct work you have to implement on your side hapi server method that called request.server.methods.login, it will use Profile.nameID for identify specific user. On client side you can check local storage variable SAMLLoggedIn for auth detecting.

Otherwise You can use your callback implementation.

For understanding options check following links:

Credits

Spec references

License

Copyright (c) 2016 archik Licensed under the MIT license.