New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

auth-driver-utils

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth-driver-utils

Useful methods to extend Auth driver.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

Auth Driver Utils Build Status

Useful methods to extend Auth driver.

Getting started

npm i auth-driver-utils

Usage

Auth(client: AuthDriver)

Expects a valid instance of Auth driver to extend upon.

.read(id: UUID)

Maps Auth driver's .get method to .read (for better CRUD naming) and applies .parse to the result.

.search(query: Object)

Extends Auth driver's .search method by applying .parse to each result.

.parse(obj: Object)

Converts an Entity from the Auth Service into an Authorization instance with helper methods (see below).

.create(obj: Object)

Creates a new entity within the Auth Service, then parses the new entity record into an Authorization instance. Note: You must provide the object in the Auth Service format (refer entity schema), not a Authorization object.

.Authorization

Provides direct access to the Authorization class, useful for testing permissions.

const Authorization = require('auth-driver-utils').Authorization;

new Authorization(<id>, <role>, <permissions>)

Permissions must be in the Authorization format e.g.

permissions: {
  <entity>: [<type>, <type>]
  ...
}

Authorization instance methods

.is(id: UUID)

Checks if the passed id matches the id of the auth user instance.

.can(perm: String, of: UUID)

Checks if user (of) has permission (perm) to do something.

.allow(perm: String, of: UUID)

Adds permission (perm) to user (of). Useful for when dealing with legacy permissions and metadata.

Keywords

FAQs

Package last updated on 30 Sep 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc