New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uportal/open-id-connect

Package Overview
Dependencies
Maintainers
9
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uportal/open-id-connect - npm Package Compare versions

Comparing version 1.33.2 to 1.34.0

LICENSE

188

cjs/open-id-connect.js

@@ -9,38 +9,2 @@ 'use strict';

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _slicedToArray(arr, i) {

@@ -55,2 +19,6 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = [];

@@ -113,99 +81,89 @@ var _n = true;

function openIdConnect() {
return _openIdConnect.apply(this, arguments);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
function _openIdConnect() {
_openIdConnect = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$timeout,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
return regeneratorRuntime.async(function openIdConnect$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return regeneratorRuntime.awrap(fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
}));
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$timeout = _ref.timeout, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
});
case 5:
response = _context.sent;
case 5:
response = _context.sent;
if (response.ok) {
_context.next = 8;
break;
}
if (response.ok) {
_context.next = 8;
break;
}
throw new Error(response.statusText);
throw new Error(response.statusText);
case 8:
_context.next = 10;
return regeneratorRuntime.awrap(response.text());
case 8:
_context.next = 10;
return response.text();
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
if (!callback) {
_context.next = 15;
break;
}
if (!callback) {
_context.next = 15;
break;
}
return _context.abrupt("return", callback(null, token));
return _context.abrupt("return", callback(null, token));
case 15:
return _context.abrupt("return", token);
case 15:
return _context.abrupt("return", token);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
if (!callback) {
_context.next = 22;
break;
}
if (!callback) {
_context.next = 22;
break;
}
return _context.abrupt("return", callback(_context.t0));
return _context.abrupt("return", callback(_context.t0));
case 22:
throw _context.t0;
case 22:
throw _context.t0;
case 23:
case "end":
return _context.stop();
}
case 23:
case "end":
return _context.stop();
}
}, _callee, null, [[2, 18]]);
}));
return _openIdConnect.apply(this, arguments);
}
}, null, null, [[2, 18]]);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/

@@ -212,0 +170,0 @@ function tokenize(jwt) {

import decode from 'jwt-decode';
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _slicedToArray(arr, i) {

@@ -48,2 +12,6 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = [];

@@ -106,99 +74,89 @@ var _n = true;

function openIdConnect() {
return _openIdConnect.apply(this, arguments);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
function _openIdConnect() {
_openIdConnect = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$timeout,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
return regeneratorRuntime.async(function openIdConnect$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return regeneratorRuntime.awrap(fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
}));
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$timeout = _ref.timeout, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
});
case 5:
response = _context.sent;
case 5:
response = _context.sent;
if (response.ok) {
_context.next = 8;
break;
}
if (response.ok) {
_context.next = 8;
break;
}
throw new Error(response.statusText);
throw new Error(response.statusText);
case 8:
_context.next = 10;
return regeneratorRuntime.awrap(response.text());
case 8:
_context.next = 10;
return response.text();
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
if (!callback) {
_context.next = 15;
break;
}
if (!callback) {
_context.next = 15;
break;
}
return _context.abrupt("return", callback(null, token));
return _context.abrupt("return", callback(null, token));
case 15:
return _context.abrupt("return", token);
case 15:
return _context.abrupt("return", token);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
if (!callback) {
_context.next = 22;
break;
}
if (!callback) {
_context.next = 22;
break;
}
return _context.abrupt("return", callback(_context.t0));
return _context.abrupt("return", callback(_context.t0));
case 22:
throw _context.t0;
case 22:
throw _context.t0;
case 23:
case "end":
return _context.stop();
}
case 23:
case "end":
return _context.stop();
}
}, _callee, null, [[2, 18]]);
}));
return _openIdConnect.apply(this, arguments);
}
}, null, null, [[2, 18]]);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/

@@ -205,0 +163,0 @@ function tokenize(jwt) {

{
"name": "@uportal/open-id-connect",
"description": "A shared Open ID Connect authorization helper for uPortal",
"version": "1.33.2",
"version": "1.34.0",
"repository": {

@@ -50,3 +50,3 @@ "type": "git",

"babel-jest": "^24.0.0",
"eslint-plugin-jest": "^22.0.0",
"eslint-plugin-jest": "^23.0.0",
"jest": "^24.0.0",

@@ -73,3 +73,4 @@ "npm-run-all": "^4.1.5",

"node": "^6.0.0 || ^8.0.0 || ^10.0.0"
}
},
"gitHead": "c97474c78026f601306f9f405706a1f0838f2348"
}

@@ -30,8 +30,7 @@ import decode from 'jwt-decode';

export default async function openIdConnect(
{
userInfoApiUrl = '/uPortal/api/v5-1/userinfo',
timeout = 50000,
propertyTransforms = {},
} = {},
callback
{
userInfoApiUrl = '/uPortal/api/v5-1/userinfo',
propertyTransforms = {}
} = {},
callback
) {

@@ -42,3 +41,3 @@ try {

method: 'GET',
credentials: 'include',
credentials: 'include'
});

@@ -86,4 +85,4 @@

encoded: jwt,
decoded: decode(jwt),
decoded: decode(jwt)
};
}

@@ -5,42 +5,6 @@ (function (global, factory) {

(global = global || self, factory(global.openIdConnect = {}, global.decode));
}(this, function (exports, decode) { 'use strict';
}(this, (function (exports, decode) { 'use strict';
decode = decode && decode.hasOwnProperty('default') ? decode['default'] : decode;
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _slicedToArray(arr, i) {

@@ -55,2 +19,6 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = [];

@@ -113,99 +81,89 @@ var _n = true;

function openIdConnect() {
return _openIdConnect.apply(this, arguments);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
function _openIdConnect() {
_openIdConnect = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var _ref,
_ref$userInfoApiUrl,
userInfoApiUrl,
_ref$timeout,
_ref$propertyTransfor,
propertyTransforms,
callback,
response,
data,
token,
_args = arguments;
return regeneratorRuntime.async(function openIdConnect$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return regeneratorRuntime.awrap(fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
}));
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref$userInfoApiUrl = _ref.userInfoApiUrl, userInfoApiUrl = _ref$userInfoApiUrl === void 0 ? '/uPortal/api/v5-1/userinfo' : _ref$userInfoApiUrl, _ref$timeout = _ref.timeout, _ref$propertyTransfor = _ref.propertyTransforms, propertyTransforms = _ref$propertyTransfor === void 0 ? {} : _ref$propertyTransfor;
callback = _args.length > 1 ? _args[1] : undefined;
_context.prev = 2;
_context.next = 5;
return fetch(userInfoApiUrl, {
method: 'GET',
credentials: 'include'
});
case 5:
response = _context.sent;
case 5:
response = _context.sent;
if (response.ok) {
_context.next = 8;
break;
}
if (response.ok) {
_context.next = 8;
break;
}
throw new Error(response.statusText);
throw new Error(response.statusText);
case 8:
_context.next = 10;
return regeneratorRuntime.awrap(response.text());
case 8:
_context.next = 10;
return response.text();
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
case 10:
data = _context.sent;
// store the encoded and decoded versions
token = tokenize(data); // Allow for additional transforms to be applied to decoded properties
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
Object.entries(propertyTransforms).forEach(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
property = _ref3[0],
transform = _ref3[1];
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
token.decoded[property] = transform(token.decoded[property]);
}); // pass value to optional call back
if (!callback) {
_context.next = 15;
break;
}
if (!callback) {
_context.next = 15;
break;
}
return _context.abrupt("return", callback(null, token));
return _context.abrupt("return", callback(null, token));
case 15:
return _context.abrupt("return", token);
case 15:
return _context.abrupt("return", token);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](2);
if (!callback) {
_context.next = 22;
break;
}
if (!callback) {
_context.next = 22;
break;
}
return _context.abrupt("return", callback(_context.t0));
return _context.abrupt("return", callback(_context.t0));
case 22:
throw _context.t0;
case 22:
throw _context.t0;
case 23:
case "end":
return _context.stop();
}
case 23:
case "end":
return _context.stop();
}
}, _callee, null, [[2, 18]]);
}));
return _openIdConnect.apply(this, arguments);
}
}, null, null, [[2, 18]]);
}
/**
* Extract JWT contents
* @param {string} jwt - JSON Web Token to decode
* @return {Object} with encoded and decoded values
*/

@@ -224,2 +182,2 @@ function tokenize(jwt) {

}));
})));
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