Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@strapi/plugin-users-permissions
Advanced tools
Protect your API with a full-authentication process based on JWT
@strapi/plugin-users-permissions is a plugin for Strapi, an open-source headless CMS. This plugin provides a robust system for managing user authentication, roles, and permissions. It allows developers to easily implement user registration, login, and role-based access control in their Strapi applications.
User Registration
This feature allows new users to register by providing a username, email, and password. The code sample demonstrates how to make a POST request to the registration endpoint.
fetch('/auth/local/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'exampleUser',
email: 'user@example.com',
password: 'password123'
})
})
.then(response => response.json())
.then(data => console.log(data));
User Login
This feature allows users to log in by providing their email (or username) and password. The code sample demonstrates how to make a POST request to the login endpoint.
fetch('/auth/local', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
identifier: 'user@example.com',
password: 'password123'
})
})
.then(response => response.json())
.then(data => console.log(data));
Role-Based Access Control
This feature allows administrators to define roles with specific permissions. The code sample demonstrates how to create a new role with permissions for creating and updating articles but not deleting them.
const role = {
name: 'Editor',
description: 'Can edit content',
permissions: {
'application::article.create': true,
'application::article.update': true,
'application::article.delete': false
}
};
fetch('/users-permissions/roles', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ADMIN_TOKEN'
},
body: JSON.stringify(role)
})
.then(response => response.json())
.then(data => console.log(data));
Passport is a popular authentication middleware for Node.js. It provides a wide range of authentication strategies, including local, OAuth, and OpenID. Unlike @strapi/plugin-users-permissions, Passport is not tied to a specific CMS and can be used with any Node.js application.
jsonwebtoken is a library for generating and verifying JSON Web Tokens (JWT). It is often used for implementing token-based authentication in web applications. While @strapi/plugin-users-permissions uses JWT under the hood, jsonwebtoken provides a lower-level API for working directly with tokens.
acl is a Node.js module for managing user roles and permissions. It provides a flexible way to define access control lists (ACLs) for different resources. Unlike @strapi/plugin-users-permissions, acl is a more general-purpose library that can be integrated into any Node.js application.
FAQs
Protect your API with a full-authentication process based on JWT
The npm package @strapi/plugin-users-permissions receives a total of 62,321 weekly downloads. As such, @strapi/plugin-users-permissions popularity was classified as popular.
We found that @strapi/plugin-users-permissions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.