Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@passport-next/chai-passport-strategy
Advanced tools
Helpers for testing Passport strategies with the Chai assertion library.
Helpers for testing Passport strategies with the Chai assertion library.
$ npm install @passport-next/chai-passport-strategy
Use this plugin as you would all other Chai plugins:
var chai = require('chai');
chai.use(require('chai-passport-strategy'));
Once used, the chai.passport.use
helper function will be available to set up
test cases for Passport strategies.
The helper function can be called from a hook to setup the test case. The
helper returns a wrapper on which callbacks are registered to be executed
when the strategy invokes its final action function. The callbacks correspond
to Passport's strategy API: success()
, fail()
, redirect()
, pass()
, and
error()
. If the strategy invokes an action that doesn't have a registered
callback, the test helper will automatically throw an exception.
The following demonstrates a Mocha test case, taken from passport-http-bearer's test suite.
describe('token strategy', function() {
var strategy = new Strategy(function(token, done) {
if (token == 'vF9dft4qmT') {
return done(null, { id: '1234' }, { scope: 'read' });
}
return done(null, false);
});
describe('handling a request with valid credential in header', function() {
var user
, info;
before(function(done) {
chai.passport.use(strategy)
.success(function(u, i) {
user = u;
info = i;
done();
})
.req(function(req) {
req.headers.authorization = 'Bearer vF9dft4qmT';
})
.authenticate();
});
it('should supply user', function() {
expect(user).to.be.an.object;
expect(user.id).to.equal('1234');
});
it('should supply info', function() {
expect(info).to.be.an.object;
expect(info.scope).to.equal('read');
});
});
});
FAQs
Helpers for testing Passport strategies with the Chai assertion library.
We found that @passport-next/chai-passport-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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.