
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Create a scope from collection of roles and/or permissions.
Originally made for use with
oauth2orize and the scope
parameter, but could be adapted to different scenarios.
npm install auth-scope
component install alexmingoia/auth-scope
var Permission = require('auth-permission')
, Role = require('auth-role')
, Scope = require('auth-scope');
// Specify any number of roles or permissions
var roles = new Scope([
Role('api')
.allow(Permission('read profile'))
.allow(Permission('read post')),
Permission('create account'),
Permission('update billing')
]);
// Get scope permissions
var permissions = scope.permissions();
JSON.stringify(permissions);
// => ['read profile', 'read post', 'create account']
// Create new scope by narrowing current scope.
var restricted = scope.narrow(['api', 'create account']));
Create a new scope from collection of permissions and roles.
Find permissions or roles in scope.
Array|String|Scope
query array of role or permission names,
another scope, or a string of comma separated role or permission names.
Returns array of roles or permissions
Create a new scope by narrowing existing scope.
Array|String|Scope
query array of role or permission names,
another scope, or a string of comma separated role or permission names.
Returns new scope.
Array|String|Scope
query array of role or permission names,
another scope, or a string of comma separated role or permission names.
Returns boolean.
Check if scope has given role or permission.
Returns boolean.
Returns array of scope roles.
Returns scope permissions, including those in scope roles.
Returns array of scope role or permission names.
Tests are written with mocha and should.js using BDD-style assertions.
Run them using npm:
npm test
FAQs
Create authorization scope from collection of roles and/or permissions.
The npm package auth-scope receives a total of 0 weekly downloads. As such, auth-scope popularity was classified as not popular.
We found that auth-scope demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.