billpatrianakos / saml2js Goto Github PK
View Code? Open in Web Editor NEWThis project forked from flesch/saml2json
Parses SAML 2.0 responses into JS objects you can read and manipulate
License: Other
This project forked from flesch/saml2json
Parses SAML 2.0 responses into JS objects you can read and manipulate
License: Other
Please update the version of lodash. Seeing a npm audit warning
npm audit
=== npm audit security report ===
┌──────────────────────────────────────────────────────────────────────────────┐
│ Manual Review │
│ Some vulnerabilities require your attention to resolve │
│ │
│ Visit https://go.npm.me/audit-guide for additional guidance │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=4.17.11 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ saml2js │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ saml2js > lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/782 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=4.17.5 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ saml2js │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ saml2js > lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/577 │
└───────────────┴──────────────────────────────────────────────────────────────┘
xmldom is no longer maintained and is affected by https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-39353
Please switch to https://www.npmjs.com/package/@xmldom/xmldom - the upgrade should be trivial as @xmldom/xmldom
is developed by the same team and is fully backwards compatible.
I'm trying to test the parser out prior to actually having everything wired up so I don't have a real response body to work with. Using the example XML snippet from the usage instructions, I am trying this:
const parser = new Saml2js(`<saml2:Attribute Name="First Name">
<saml2:AttributeValue>John</saml2:AttributeValue>
</saml2:Attribute>`)
const samlObj = parser.toObject()
const samlJSON = parser.toJSON()
console.log('*** saml route samlObj: ', samlObj)
console.log('*** saml route samlJSON: ', samlJSON)
console.log(`*** saml route parser.get('first name'): `, parser.get('first name'))
My terminal output:
*** saml route samlObj: {}
*** saml route samlJSON: {}
*** saml route parser.get('first name'): undefined
Ran into an issue using this library. If we invoke this twice, the result of the second instance is from the first invocation.
This is because profile is a global variable
var xmldom = require('xmldom'),
xpath = require('xpath'),
_ = require('lodash'),
profile = {}; // <------------------------ Culprit: Global Variable
// Saml2js
// -------
// Constructor function. Saves a copy
// of the raw SAML you pass to it and
// a copy that's parsed into a JS object.
//
// `response` [String] - A SAML response string
function Saml2js (response) {
this.rawSaml = response;
this.parsedSaml = this.parse(response);
}
HI there,
Thanks so much for putting this together. Am sure it will save me a load of time on the long run.
But just to let you know, the README.md has a typo, I think, in the section regarding toObject().
The sample code references "asObject()" ... which, of course, isn't a function.
Just spent a good 25 minutes wondering if I was mad or not.
Thanks
Neal
Your documentation says to execute parser.asObject() when the actual function is parser.toObject()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.