Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Upgrade s3o-middleware-utils to 2.0.0 #53

Merged
merged 2 commits into from
Mar 26, 2019
Merged

Conversation

Limess
Copy link
Contributor

@Limess Limess commented Mar 26, 2019

This removes express cookie utilities from s3o-middleware-utils, and exports a factory function from authenticate which takes a sync public key getter and returns authenticateToken and validate methods. This was to allow s3o-lambda to consume the same library without immediately polling for public key changes (Financial-Times/s3o-middleware-utils#8).

This change adds the cookie utils to this library and adjusts the calls to the middleware utils to keep the existing API intact. I'd have liked to expose this middleware with a factory function as an entry point as well:

  • Prevents immediate eager calls to the public key endpoint
  • Makes it easier to tests APIs using this library without having to disable/stub s3o or do a conditional require

however I don't personally have the appetite to manage that upgrade process.

Note: s3o-middleware-utils now requires node.js >= 8. This is due to an ft-poller version update including native async/await calls. This should result in this being a major release. node.js 6 supports ends at the end of next month (April 2019) so I believe this is a reasonable breaking change at this point.

This would not require consumers to update immediately.

This removes express cookie utilities from s3o-middleware-utils, and exports a factory function from authenticate
which takes a sync public key getter and returns authenticateToken and validate methods.

This change adds the cookie utils to this library and adjusts the calls to the middleware utils to keep the existing
API intact.

Note: s3o-middleware-utils now requires node.js >= 8. This is due to an ft-poller version update including native async/await calls.
lib/cookies.js Outdated
* Gets s3o username from request cookies
*
* @param {object} req Express request object
* @return {string} The S3O username if it exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return {string} The S3O username if it exists
* @return {string|undefined} The S3O username if it exists

lib/cookies.js Outdated
* Gets s3o username from request cookies
*
* @param {object} req Express request object
* @return {string} The S3O token if it exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return {string} The S3O token if it exists
* @return {string|undefined} The S3O token if it exists

@Limess Limess merged commit 7c71521 into master Mar 26, 2019
@Limess Limess deleted the upgrade-s3o-middleware-utils branch March 26, 2019 15:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants