dadi / passport

A library for generating access tokens to authenticate with DADI platform components
7 stars 3 forks source link

Add HTTP/2 support to Node implementation #26

Closed eduardoboucas closed 8 years ago

eduardoboucas commented 8 years ago

This PR adds HTTP/2 support to the Node.js implementation of Passport.

Usage is as follows:

var certificate = fs.readFileSync('./../api/config/example/localhost.crt');

var passportOptions = {
    issuer: {
        uri: 'localhost',
        port: 3000,           // Optional. Defaults to 80 when HTTP/1.x, 443 when HTTP/2
        endpoint: '/token'    // Optional. Defaults to '/token'
    },
    credentials: {
        clientId: 'testClient',
        secret: 'superSecret'
    },
    wallet: 'file',
    walletOptions: {
        path: './token.txt'
    },
    http2: true,              // Indicates that the request should be done through HTTP/2
    ca: certificate           // Optional. Uses a self-signed certificate
};

Existing tests are passing. I haven't had the chance to add any tests for the new feature yet. I'll do this over the next couple of days, but I wanted to push this branch asap as @kevinsowers223 needs this feature for Web.

@jimlambie @kevinsowers223 let me know your thoughts.

Thanks!

eduardoboucas commented 8 years ago

Merging this. @jimlambie can you kindly publish to npm?