Socket
Book a DemoInstallSign in
Socket

feathers-jwt-impersonate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-jwt-impersonate

A custom verifier that sits on top of feathers-authentication and feathers-authentication-jwt

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

feathers-jwt-impersonate

Build Status

DISCLAIMER: Use this at your own risk. This is a very early prototype.

This is a feathers-authentication plugin that implements user impersonation. It is just a simple custom verifier that sits on top of feathers-authentication-jwt. As such, the default options are the same, except for these ones:

{
  name: 'impersonate',
  entity: 'user',
  service: 'users',
  rolesField: 'roles',
  allowedRole: 'admin',
  Verifier: ImpersonateVerifier,
}

This is a very crude/simple solution, but it works right now. will add tests as soon as time permits.

Installation:

yarn add feathers-jwt-impersonate

or

npm install feathers-jwt-impersonate --save

Usage:

authentication.js

  import authentication from 'feathers-authentication';
  import impersonate from 'feathers-jwt-';

  .
  .
  .

  export default function() {
    const app = this;
    const config = app.get('authentication');

    app.configure(authentication(config));
    app.configure(impersonate());

    .
    .
    .
  }

  app.service('authentication').hooks({
    before: {
      create: [authentication.hooks.authenticate(['impersonate'])],
    },
  });

Expected Payload

{
	"strategy": "impersonate",
	"userId": "596d4832c816ca24a29b1b81" // userId of the user that you want to impersonate
}

PRs and code reviews are welcome to make this more generic / acceptable to use for a wide variety of cases.

Keywords

feathersjs

FAQs

Package last updated on 18 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.