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

@boxyhq/saml20

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boxyhq/saml20 - npm Package Compare versions

Comparing version 1.0.15 to 1.1.0

10

dist/decrypt.js

@@ -32,13 +32,13 @@ "use strict";

if (!Array.isArray(encryptedAssertions)) {
throw new Error('Error Undefined Encrypted Assertion.');
throw new Error('Undefined Encrypted Assertion.');
}
if (encryptedAssertions.length !== 1) {
throw new Error('Error Multiple Assertion.');
throw new Error('Multiple Assertion.');
}
return xmlenc.decrypt(encryptedAssertions[0], { key: options.privateKey }, (err, res) => {
if (err) {
return new Error('Error Exception of Assertion Decryption.');
throw new Error('Exception of Assertion Decryption.');
}
if (!res) {
return new Error('Error Undefined Encryption Assertion.');
throw new Error('Undefined Encryption Assertion.');
}

@@ -53,3 +53,3 @@ const assertionNode = (0, utils_1.parseFromString)(res);

if (!entireXML) {
return new Error('Error Undefined Assertion.');
throw new Error('Undefined Assertion.');
}

@@ -56,0 +56,0 @@ const xml = (0, utils_1.parseFromString)(entireXML);

@@ -7,2 +7,3 @@ "use strict";

const lodash_1 = __importDefault(require("lodash"));
const permanentNameIdentifier = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent';
const nameIdentifierClaimType = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier';

@@ -13,3 +14,7 @@ function getClaims(attributes) {

const attributeName = attribute['@'].Name;
claims[attributeName] = getProp(attribute, 'AttributeValue');
const extProp = getExtendedProp(attribute, 'AttributeValue', 'NameID');
claims[attributeName] = extProp.result;
if (extProp.format === permanentNameIdentifier) {
claims[nameIdentifierClaimType] = extProp.result;
}
});

@@ -29,4 +34,5 @@ return claims;

}
function getProp(obj, prop) {
function getExtendedProp(obj, prop, extraProp) {
let result = prop ? lodash_1.default.get(obj, prop) : obj;
const format = result && result['@'] && result['@'].Format ? result['@'].Format : null;
if (result && result._) {

@@ -36,4 +42,6 @@ result = result._;

if (typeof result === 'string') {
result = trimWords(result);
return result;
return {
result: trimWords(result),
format,
};
}

@@ -44,8 +52,12 @@ else if (result instanceof Array) {

});
return result;
return { result, format };
}
else {
return;
else if (extraProp && result && result[extraProp]) {
return getExtendedProp(result[extraProp]);
}
return {};
}
function getProp(obj, prop, extraProp) {
return getExtendedProp(obj, prop, extraProp).result;
}
const parse = (assertion) => {

@@ -59,3 +71,3 @@ let claims = {};

const subjectName = getProp(assertion, 'Subject.NameID');
if (subjectName) {
if (subjectName && !claims[nameIdentifierClaimType]) {
claims[nameIdentifierClaimType] = subjectName;

@@ -62,0 +74,0 @@ }

{
"name": "@boxyhq/saml20",
"version": "1.0.15",
"version": "1.1.0",
"description": "SAML 2.0 token parser for Node.js",

@@ -59,6 +59,6 @@ "keywords": [

"@types/chai": "4.3.4",
"@types/mocha": "10.0.0",
"@types/mocha": "10.0.1",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.43.0",
"@typescript-eslint/eslint-plugin": "5.45.0",
"@typescript-eslint/parser": "5.45.0",
"chai": "4.3.7",

@@ -68,6 +68,6 @@ "eslint": "8.28.0",

"husky": "8.0.2",
"lint-staged": "13.0.3",
"lint-staged": "13.0.4",
"mocha": "10.1.0",
"nyc": "15.1.0",
"prettier": "2.7.1",
"prettier": "2.8.0",
"ts-node": "10.9.1",

@@ -74,0 +74,0 @@ "tsconfig-paths": "4.1.0",

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