adobe / aio-lib-ims

Adobe I/O JavaScript SDK supporting Adobe IMS (Identity Management System) authentication
https://www.adobe.io
Apache License 2.0
5 stars 13 forks source link

feat: validation caching and allow list #112

Closed MichaelGoberling closed 1 year ago

MichaelGoberling commented 1 year ago

Description

This PR adds the validation caching functionality currently used by the shared validator actions.

It also adds a new function that allows implementers to validate a token against an allow-list of IMS clients.

This should not be breaking as the validateToken call should return the same data as before. The old validateToken function has been moved to a private function _validateToken, and has been slightly modified to work with ValidationCache.

Motivation and Context

To use in the App Builder Delete Service and allow others to cache validations / invalidations. To allow validating a token against an allow-list.

How Has This Been Tested?

Ran npm run test, branch tested against Delete Service ims-auth PR

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Merging #112 (e3ec3b8) into master (b11c0d8) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #112   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         9    +1     
  Lines          428       481   +53     
  Branches        58        68   +10     
=========================================
+ Hits           428       481   +53     
Impacted Files Coverage Δ
src/ValidationCache.js 100.00% <100.00%> (ø)
src/ims.js 100.00% <100.00%> (ø)
src/index.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more