Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@tryghost/mw-session-from-token
Advanced tools
Middleware to handle generating sessions from tokens, for example like with magic links, or SSO flows similar to SAML.
Middleware to handle generating sessions from tokens, for example like with magic links, or SSO flows similar to SAML.
npm install @tryghost/mw-session-from-token --save
or
yarn add @tryghost/mw-session-from-token
const sessionFromTokenMiddleware = require('@tryghost/mw-session-from-token')({
callNextWithError: true,
async createSession(req, res, user) {
req.session.user_id = user.id;
},
async getTokenFromRequest(res) {
return req.headers['some-cool-header'];
},
async getLookupFromToken(token) {
await someTokenService.validate(token);
const data = await someTokenService.getData(token);
return data.email;
},
async findUserByLookup(lookup) {
return await someUserModel.findOne({email: lookup});
}
});
someExpressApp.get('/some/sso/url', someSessionMiddleware, sessionFromTokenMiddleware, (req, res, next) => {
res.redirect('/loggedin');
}, (err, res, res, next) => {
res.redirect('/error');
});
This is a mono repository, managed with lerna.
Follow the instructions for the top-level repo.
git clone
this repo & cd
into it as usualyarn
to install top-level dependencies.yarn dev
yarn lint
run just eslintyarn test
run lint and testsCopyright (c) 2013-2022 Ghost Foundation - Released under the MIT license.
FAQs
Middleware to handle generating sessions from tokens, for example like with magic links, or SSO flows similar to SAML.
We found that @tryghost/mw-session-from-token demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 22 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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.