@microservice-framework/microservice-auth

1.3.6 • Public • Published

microservice-auth

Gitter npm microservice-frame.work

AuthToken microservice for microservice-framework

Create token

const MicroserviceClient = require('@microservice-framework/microservice-client');

require('dotenv').config();

var client = new MicroserviceClient({
  URL: process.env.SELF_URL,
  secureKey: process.env.SECURE_KEY
});

client.post({
    ttl: 600,
    credentials: {
      username: 'Gormartsen'
    },
    scope:[
      {
        service: 'service1',
        methods: {
          get:true,
          post:false,
          put: false,
          search: true,
          delete: false,
        }
      },
      {
        service: 'service2',
        methods: {
          get:true,
          post:false,
          put: false,
          search: true,
          delete: false,
        }
      }
    ]
  }, function(err, handlerResponse){
    console.log(err);
    console.log(JSON.stringify(handlerResponse , null, 2));
});
  • ttl - access token live time. Use -1 to create immortal token.
  • credentials - object that will be available by requestDetails.credentials in GET/POST/PUT/SEARCH/DELETE methods under microservice.
  • scope - array of objects where:
    • service: SCOPE value from microservice register function.
    • methods: true - access allowed, false - denied.

Changle log

  • 1.3.5 - fix 'access-token' validation
  • 1.3.6 - add scope output on token GET

Readme

Keywords

none

Package Sidebar

Install

npm i @microservice-framework/microservice-auth

Weekly Downloads

1

Version

1.3.6

License

GPL-3.0

Unpacked Size

24.9 kB

Total Files

12

Last publish

Collaborators

  • microservice-framework