Token redelegation exchange for OAuth2orize.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
support/mk
test
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE
Makefile
README.md
package.json

README.md

oauth2orize-redelegate

Build Coverage Quality Dependencies Tips

Token redelegation exchange for OAuth2orize.

This exchange is used by a resource server to exchange an access token it has recieved from a client for a derivative token for use with another resource server. This scenario facilitiates service chaining, in which one service needs to communicate with another service in order to fulfill the original request.

Install

$ npm install oauth2orize-redelegate

Usage

Register Exchange

Register the exchange with an OAuth 2.0 server.

var redelegate = require('oauth2orize-redelegate').exchange.redelegate;

server.exchange('urn:ietf:params:oauth:grant_type:redelegate', redelegate(function(client, token, scope, done) {
  AccessToken.verify(token, function(err, t) {
    if (err) { return done(err); }

    var random = utils.uid(256);
    var at = new AccessToken(random, t.userId, client.id, t.scope);
    at.save(function(err) {
      if (err) { return done(err); }
      return done(null, random);
    });
  });
});

Implementation

This module is implemented based on A Method of Bearer Token Redelegation and Chaining for OAuth 2, Draft 00. Implementers are encouraged to track the progress of this specification and update update their implementations as necessary. Furthermore, the implications of relying on a non-final draft specification should be understood prior to deployment.

Related Modules

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2014 Jared Hanson <http://jaredhanson.net/>