Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
loopback-component-oauth2
Advanced tools
The LoopBack oAuth 2.0 component provides full integration between OAuth 2.0 and LoopBack. It enables LoopBack applications to function as an oAuth 2.0 provider to authenticate and authorize client applications and/or resource owners (i.e. users) to access protected API endpoints.
The oAuth 2.0 protocol implementation is based on oauth2orize and passport.
There are a few key building blocks in loopback-component-oauth2 to provide full oAuth 2.0 server-side capabilities:
Authorization server: The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization.
Resource server: The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.
The authorization server may be the same server as the resource server or a separate entity. A single authorization server may issue access tokens accepted by multiple resource servers.
For authorization servers, loopback-component-oauth2 implements the oAuth 2.0 protocol endpoints, including authorization endpoint and token endpoint.
For resource servers, loopback-component-oauth2 provides middleware to protect api endpoints. Only those requests with valid oAuth 2.0 access tokens can be accepted. It also establishes identities such as client application id and user id for further access control and personalization.
loopback-component-oauth2 defines the following models to manage oAuth 2.0 metadata such as access tokens, authorization codes, clients (i.e, applications), and resource owners (i.e. users).
It also uses the user and application model from the loopback module:
var oauth2 = require('loopback-component-oauth2');
var options = {
dataSource: app.dataSources.db, // Data source for oAuth2 metadata persistence
loginPage: '/login', // The login page url
loginPath: '/login' // The login form processing url
};
oauth2.oAuth2Provider(
app, // The app instance
options // The options
);
The app instance will be used to set up middleware and routes. The data source provides persistence for the oAuth 2.0 metadata models.
There are two option properties to indicate if you want to set up the oAuth 2.0 provider as an authorization server, a resource server, or both.
The following options are available for an authorization server:
authorizePath (string or false)
tokenPath (string or false)
decisionPath (string or false)
decisionView (string)
decisionPage (string)
loginPath (string or false)
loginPage (string)
The supportedGrantTypes
option controls what grant types should be enabled:
oauth2.authenticate(['/protected', '/api', '/me'],
{session: false, scope: 'email'});
This example demonstrates how to implement an OAuth service provider, complete with protected API access.
FAQs
OAuth 2.0 provider for LoopBack
The npm package loopback-component-oauth2 receives a total of 245 weekly downloads. As such, loopback-component-oauth2 popularity was classified as not popular.
We found that loopback-component-oauth2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 20 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.