Giter Site home page Giter Site logo

hapi-auth-siteminder's Introduction

hapi-auth-siteminder

npm version

Authentication plugin for Siteminder protected sites.

Usage

const siteminder = {
    register: require('hapi-auth-siteminder'),
    options: {
        // Headers required by your application
        required: ['HTTP_SM_USER', 'HTTP_SM_USERID']   
    }  
};

server.register([opentoken], (err) => {
    server.auth.strategy('default', 'siteminder', { validate: validate });
    server.route({ method: 'GET', path: '/', config: { auth: 'default' } });
});

function validate(request, headers, callback) {
    // headers contains all headers sent with this request
    // additional processing such as gather information from the
    // database can occur here and be attached to the object
    
    // note: hapijs headers are always lowercase property names
    
    callback(err, { 
        id: headers.http_sm_userid, 
        username: headers.http_sm_user 
    });
}

Options

Plugin takes the following options

  • required - (optional) The headers that your application requires. Use this to specify headers your application requires for later processing. If a required header is missing, the plugin will throw and authorization exception. Regardless of what headers are marked as required, the plugin will still send all avaiable headers to the validate function. Case insensitive. (default: [])

Validation

The validation function has a signature of validate(request, headers, callback) where

  • request - the hapi.js request object
  • headers - all headers in the request
  • callback - a callback function taking the following parameters
    • err - An optional error message which gets logged to stdout, null if no error
    • user - the user information to attach to request.auth.credentials in downstream methods

hapi-auth-siteminder's People

Contributors

carbonrobot 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.