开发者社区> 镜像站> NPM> consulate-simple-secrets
consulate-simple-secrets
simple-secrets token plugin for consulate
Last updated 6 years ago by camshaft .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install consulate-simple-secrets 
SYNC missed versions from official npm registry.

consulate-simple-secrets Build Status

simple-secrets token plugin for consulate

Usage

Just register consulate-simple-secrets as a plugin with your consulate server:

var consulate = require('consulate')
  , ss = require('consulate-simple-secrets');

var app = consulate();

app.plugin(ss({
  key: '3b6006d164bae955136a5befea9d0e4a50c22a2f7be5d65c2fd67752625deee3'
}));

This will return encrypted tokens with embedded token information:

{
  u: 'user-id',
  s: 42, // compressed scopes
  c: 'client-id',
  e: 1234 // expiration date
}

TODO explain how to extract token information

Advanced Usage

The options accepts a transform function to change the token information. This can be used to add extra fields in the token.

app.plugin(ss({
  transform: function(client, user, scope, availableScopes, tokenOpts, done) {
    // transform the tokenOpts here

    done(null, tokenOpts);
  }
}));

Tests

$ npm test

Current Tags

  • 0.1.1                                ...           latest (6 years ago)

2 Versions

  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (4)
Dev Dependencies (2)
Dependents (0)
None