Skip to content

Usurp a user identity by checking a header presence

Notifications You must be signed in to change notification settings

nutshell-lab/usurper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usurper

Usurp a user identity by checking a header presence

Usage

Install it

npm i usurper
#OR
yarn add usurper

Expected pattern

Usurper will expect this pattern :

{
  "Authorization": "usurp=anyone@anything.watev"
}

Use it

const Usurper = require('usurper')

//Optionnaly configure it
Usurper.configure(options)

const [success, identity] = Usurper.usurp(ctx.request.headers.authorization)
const user = sucess && await findUser(identity) // do anything you want with usurped user Id

Options

name description default
disabled turn off usurper `process.env.USURPER_DISABLED === 'true'
verbose Log in console usurped identity false

About

Usurp a user identity by checking a header presence

Resources

Stars

Watchers

Forks

Packages

No packages published