Simple, secure redirect-uri check with wildcard support for consulate
JavaScript
Switch branches/tags
Nothing to show
Latest commit e3d8707 Feb 4, 2015 @camshaft camshaft fix tests
Permalink
Failed to load latest commit information.
test fix tests Feb 4, 2015
.gitignore Initial commit Jun 29, 2013
.travis.yml Initial commit Jun 29, 2013
README.md Rename package Jun 29, 2013
index.js use hostname instead of host Feb 4, 2015
package.json release 0.1.1 Feb 4, 2015

README.md

consulate-validate-redirect-uri Build Status

Simple, secure redirect-uri check with wildcard support for consulate

Usage

Just register consulate-validate-redirect-uri as a plugin with your consulate server:

var consulate = require('consulate')
  , uriCheck = require('consulate-validate-redirect-uri');

var app = consulate();

app.plugin(uriCheck());

The plugin will check client.redirect_uri and try to match it against the redirect_uri for the request. It can be either a string or an array:

string

var client = {
  redirect_uri: 'https://example.com'
};

array

var client = {
  redirect_uri: [
    'https://example.com',
    'https://otherdomain.com'
  ]
};

wildcard

If wildcard support is needed just use a *:

var client = {
  redirect_uri: 'https://*.example.com'
};

var redirect_uri1 = 'https://test.example.com'; // will be matched
var redirect_uri2 = 'https://example.com'; // will not be matched

subpath

Any paths on the redirect_uri that match the registered client.redirect_uri will be matched as well:

var client = {
  redirect_uri: 'https://example.com/test'
};

var redirect_uri1 = 'https://example.com/test/1/2/3'; // will be matched
var redirect_uri2 = 'https://example.com/other/path/4/5/6'; // will not be matched

Tests

$ npm test