Skip to content

microservice-framework/microservice-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Auth Service to provide Access Token authorization

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published