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.
passport-http-header-strategy
Advanced tools
HTTP Bearer set header authentication strategy for Passport
HTTP define header authentication strategy for Passport
$ npm install passport-http-header-strategy
header
set header(default authorization
)param
set use req.body
or req.query
token
name to request(default access_token
)passReqToCallback
if eturnpassport.use(new headerStrategy({header: 'X-APP-TOKEN', param: 'app_token', passReqToCallback: true},
function(req, token, done) {
User.findOne({ token: token }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
return done(null, user, { scope: 'all' });
});
}
));
Use passport.authenticate()
, specifying the 'bearer'
strategy, to
authenticate requests. Requests containing bearer tokens do not require session
support, so the session
option can be set to false
.
For example, as route middleware in an Express application:
app.get('/profile',
passport.authenticate('header', { session: false }),
function(req, res) {
res.json(req.user);
});
examples - example
$ npm install
$ mocha
ReferJared Hanson passport-http-bearer module
FAQs
HTTP Bearer set header authentication strategy for Passport
The npm package passport-http-header-strategy receives a total of 23,234 weekly downloads. As such, passport-http-header-strategy popularity was classified as popular.
We found that passport-http-header-strategy 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.
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.