Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-gateway-plugin-tookie

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-gateway-plugin-tookie - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.idea/encodings.xml

41

manifest.js
const jsonParser = require('express').json();
const plugin = {
version: '1.0.0',
version: '1.1.0',
policies: ['tookie'],
init: function (pluginContext) {
pluginContext.registerPolicy({
name: 'tookie',
policy: (actionParams) => {
return (req, res, next) => {
if (req.method === 'POST') {
jsonParser(req, res, (err) => {
if (err) return next(err);
return res.status(204).cookie('id_token', req.body.token, {
httpOnly: true,
secure: true,
// The age is taken from GMT so we add +1h for our timezone. * 1000 for ms
maxAge: (req.body.expires + 3600) * 1000
}).send();
});
} else {
return res.status(204).clearCookie('id_token').send();
pluginContext.registerPolicy({
name: 'tookie',
policy: (actionParams) => {
return (req, res, next) => {
if (req.method === 'POST') {
jsonParser(req, res, (err) => {
if (err) return next(err);
return res.status(204).cookie('id_token', req.body.token, {
httpOnly: true,
secure: true,
maxAge: (req.body.expires) * 1000
}).send();
});
} else {
return res.status(204).clearCookie('id_token').send();
}
}
}
}
}
})
})
}

@@ -29,0 +28,0 @@ };

{
"name": "express-gateway-plugin-tookie",
"version": "1.0.0",
"version": "1.1.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "manifest.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc