New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sinopia-memory

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinopia-memory

auth plugin for sinopia that keeps users in memory

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
5
25%
Maintainers
1
Weekly downloads
 
Created
Source

sinopia-memory

This sinopia auth plugin keeps the users in a memory plain object. This means all sessions and users will disappear when you restart the sinopia server.

This plugin is used with external authentication (in my case GitHub Oauth). This means that it doesn't matter if users are deleted at rebooting because once the oauth callback is complete the user/token is recreated.

If you want to use this piece of software, do it at your own risk.

Installation

$ npm install sinopia
$ npm install sinopia-memory

Config

Add to your config.yaml:

auth:
  memory: true

For plugin writers

It's called as:

require('sinopia-memory')(config, stuff)

Where:

  • config - module's own config
  • stuff - collection of different internal sinopia objects
    • stuff.config - main config
    • stuff.logger - logger

This should export two functions:

  • adduser(user, password, cb)

    It should respond with:

    • cb(err) in case of an error (error will be returned to user)
    • cb(null, false) in case registration is disabled (next auth plugin will be executed)
    • cb(null, true) in case user registered successfully

    It's useful to set err.status property to set http status code (e.g. err.status = 403).

  • authenticate(user, password, cb)

    It should respond with:

    • cb(err) in case of a fatal error (error will be returned to user, keep those rare)
    • cb(null, false) in case user not authenticated (next auth plugin will be executed)
    • cb(null, [groups]) in case user is authenticated

    Groups is an array of all users/usergroups this user has access to. You should probably include username itself here.

Keywords

sinopia

FAQs

Package last updated on 01 Mar 2016

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