Coder Social home page Coder Social logo

node-samlp's Introduction

SAML Protocol middleware to create SAMLP identity providers for node.js.

Build Status

Installation

npm install samlp

Introduction

This middleware is meant to generate a valid SAML Protocol identity provider endpoint that speaks saml.

The idea is that you will use another mechanism to validate the user first.

The endpoint supports metadata as well in the url /FederationMetadata/2007-06/FederationMetadata.xml.

Usage

Options

Name Description Default
cert public key used by this identity provider REQUIRED
key private key used by this identity provider REQUIRED
getPostURL get the url to post the token f(audience, samlRequestDom, req, callback) REQUIRED
issuer the name of the issuer of the token REQUIRED
audience the audience for the saml token req.query.SAMLRequest.Issuer
getUserFromRequest how to extract the user information from request function(req) { return req.user; }
profileMapper mapper to map users to claims (see PassportProfileMapper) PassportProfileMapper
signatureAlgorithm signature algorithm, options: rsa-sha1, rsa-sha256 'rsa-sha256'
digestAlgorithm digest algorithm, options: sha1, sha256 'sha256'
RelayState state of the auth process ```req.query.RelayState
sessionIndex the index of a particular session between the principal identified by the subject and the authenticating authority SessionIndex is not included
responseHandler custom response handler for SAML response f(req, res, SAMLResponse) HTML response that POSTS to postUrl

Add the middleware as follows:

app.get('/samlp', samlp.auth({
  issuer:     'the-issuer',
  cert:       fs.readFileSync(path.join(__dirname, 'some-cert.pem')),
  key:        fs.readFileSync(path.join(__dirname, 'some-cert.key')),
  getPostURL: function (wtrealm, wreply, req, callback) { 
                return cb( null, 'http://someurl.com')
              }
}));

SAML Protocol Metadata

This module also support generating SAML Protocol metadata (IDPSsoDescriptor):

app.get('/samlp/FederationMetadata/2007-06/FederationMetadata.xml', samlp.metadata({
  issuer:   'the-issuer',
  cert:     fs.readFileSync(path.join(__dirname, 'some-cert.pem')),
}));

It also accept two optionals parameters:

  • profileMapper: a class implementing the profile mapper. This is used to render the claims type information (using the metadata property). See PassportProfileMapper for more information.
  • endpointPath: this is the full path in your server to the auth route. By default the metadata handler uses the metadata request route without /FederationMetadata/2007..blabla.

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.

node-samlp's People

Contributors

andyskw avatar eugeniop avatar explunit avatar jfromaniello avatar lcalvy avatar ntotten avatar pose avatar siacomuzzi avatar woloski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.