How to use the samlp.auth function in samlp

To help you get started, we’ve selected a few samlp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / samlp / samlp-tests.ts View on Github external
import * as fs from 'fs';
import * as path from 'path';
import * as express from 'express';
import * as samlp from 'samlp';


// Example
const app = express();

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, cb) {
                return cb( null, 'http://someurl.com')
              }
}));

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


app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
  samlp.parseRequest(req, (err: any, data: any) => {
github open-rpa / openflow / OpenFlow / src / SamlProvider.ts View on Github external
} catch (error) {
                        res.body(error.message);
                        res.end();
                        console.error(error);
                    }
                } else {
                    // continue with issuing token using samlp
                    next();
                }
            } else {
                res.send("go away!");
                res.end();
            }
        });

        app.get("/issue/", samlp.auth(samlpoptions));
        app.get("/issue/FederationMetadata/2007-06/FederationMetadata.xml", samlp.metadata({
            issuer: Config.saml_issuer,
            cert: cert,
        }));
        // var SessionParticipants = require('samlp/lib/sessionParticipants');

        // https://github.com/mcguinness/saml-idp/blob/master/app.js
        // https://www.diycode.cc/projects/auth0/node-samlp
        // https://github.com/auth0/node-samlp/blob/master/lib/sessionParticipants/index.js
        // app.get('/logout', samlp.logout({
        //     deflate:            true,
        //     issuer:             'the-issuer',
        //     protocolBinding:    'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
        //     cert:               cert,
        //     key:                key
        // }));
github mcguinness / saml-idp / app.js View on Github external
}

    // Set Session Index
    authOptions.sessionIndex = getSessionIndex(req);

    // Keep calm and Single Sign On
    console.log(dedent(chalk`
      Generating SAML Response using =>
        {bold User} => ${Object.entries(req.user).map(([key, value]) => chalk`
          ${key}: {cyan ${value}}`
        ).join('')}
        {bold SAMLP Options} => ${Object.entries(authOptions).map(([key, value]) => chalk`
          ${key}: {cyan ${formatOptionValue(key, value)}}`
        ).join('')}
    `));
    samlp.auth(authOptions)(req, res);
  })

samlp

SAML Protocol server middleware

MIT
Latest version published 11 months ago

Package Health Score

67 / 100
Full package analysis