@rackspace-identity-platform/cookie-monster

0.5.0 • Public • Published

Cookie Monster

Cookie Monster is a set of tools to manage tab-based session cookies.

The process for tab-based sessions is to use browser cookies for transport rather than an data storage. CookieMonster provides two tools help make this happen, a script and a page template. The script will hook into all server-communication methods in the browser to create this affect. The page template is designed as a customizable HTML page to serve in case the server endpoint receives an webpage GET request with no session cookie. It checks for a session and resends the request or forwards the browser to a provided auth url.

Implementation Prerequisites

  • The CookieMonster script must be loaded (synchronously) after polyfills but before any code that might wrap fetch/XHR (if those features are used).
  • Session cookies must have "httpOnly" turned off.

Usage

Add CookieMonster to your project:

Using npm:

npm install --save @rackspace-identity-platform/cookie-monster

Or yarn:

yarn add @rackspace-identity-platform/cookie-monster

See each feature's documentation linked below.

TODO

  • Consider timeouts on sessionStorage values.
  • Add semaphors to mitigate race conditions that may happen when more than one tab sends requests to the server at a time.

Readme

Keywords

none

Package Sidebar

Install

npm i @rackspace-identity-platform/cookie-monster

Weekly Downloads

0

Version

0.5.0

License

MIT

Unpacked Size

14.9 kB

Total Files

8

Last publish

Collaborators

  • explorigin
  • identity-platform